Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action('rest_api_init', 'register_custom_endpoints');
- function register_custom_endpoints(){
- register_rest_route($base, $endpoint, [
- 'methods' => 'POST',
- 'callback' => function($request){
- // Return JSON data
- },
- 'permission_callback' => function($request){
- // This always returns false
- return is_user_logged_in();
- },
- ]);
- }
- {code: "rest_user_invalid_id", message: "Invalid user ID.", data: {status: 404}}
Add Comment
Please, Sign In to add comment