Skip to content

Instantly share code, notes, and snippets.

@wunderdojo
Created June 9, 2018 05:09
Show Gist options
  • Save wunderdojo/034c47fbf0ab11eeb6274eae6a71bad4 to your computer and use it in GitHub Desktop.
Save wunderdojo/034c47fbf0ab11eeb6274eae6a71bad4 to your computer and use it in GitHub Desktop.
Sample API Endpoint
register_rest_route( MSAPIPATH, '/accounts',
[
'methods' => \WP_REST_Server::READABLE,
'callback' => [
'MS\Controllers\Accounts_API_Controller', 'api_route_get_accounts'
],
'permission_callback' => function () {
return current_user_can( 'ms-manage-accounts' );
}
]
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment