Created
June 20, 2017 10:39
-
-
Save mustafauysal/498c7f545348153504dee03caf8e4d85 to your computer and use it in GitHub Desktop.
non-namespaced route for WP REST API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'rest_api_init', function ( $server ) { | |
$server->register_route( 'foo', '/foo', array( | |
'methods' => 'GET', | |
'callback' => function () { | |
return 'baz'; | |
}, | |
) ); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
alternatively