custom api endpoints jwt token

The solution for “custom api endpoints jwt token” can be found here. The following code will assist you in solving the problem.

add_action(‘rest_api_init’, function ($data) {
register_rest_route(‘mladi-info/v1’, ‘/user/favorites’,
‘methods’ => ‘GET’,
‘callback’ => ‘mi_get_favorite_posts’,
‘permission_callback’ => function ($request) {
if (current_user_can(‘edit_others_posts’))
return true;

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

inline scripts encapsulated in