Advertisement
pendekar_langit

tes wp route

Jul 21st, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. <?php
  2. defined('ABSPATH') or die("Fuck accessing!");
  3.  
  4. /**
  5. * Create route for access to api url
  6. */
  7. function create_routes(WP_Router $route){
  8. $router->add_route('manage-api-routes', array(
  9. 'path' => '^api$',
  10. 'access_callback' => true,
  11. 'page_callback' => function(){
  12. echo "Tes route api";
  13. },
  14. 'template' => false
  15. ));
  16. }
  17. add_action( 'wp_router_generate_routes', 'create_routes' );
  18.  
  19.  
  20. /**
  21. * Manage subpath route access to api
  22. */
  23. function manage_api_routes(){
  24. echo "tes route api";
  25. }
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement