Last active
April 28, 2017 13:47
-
-
Save mklasen/f624ef04c8d80cb8b7ed5c47343630f4 to your computer and use it in GitHub Desktop.
Add WordPress REST API Endpoint
This file contains hidden or 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
add_action( 'rest_api_init', function () { | |
register_rest_route( 'myplugin/v1', '/author/(?P<id>\d+)', array( | |
'methods' => 'GET', | |
'callback' => function($request) { | |
print_r($request->get_params()); | |
}, | |
) ); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment