custom api endpoints jwt token code example
Example: custom api endpoints jwt token
add_action('rest_api_init', function ($data) {
register_rest_route('mladi-info/v1', '/user/favorites',
array(
'methods' => 'GET',
'callback' => 'mi_get_favorite_posts',
'permission_callback' => function ($request) {
if (current_user_can('edit_others_posts'))
return true;
}
)
);
});