API whitelist problem
-
Hello! I successfully added endpoint ‘/wp-json/wp/v2/posts’ to whitelist, but I still can’t open particular post.
My question is – what endpoint I must write to make available without authorization every post? Something like: ‘/wp-json/wp/v2/posts/{ID}’
Putting * in place of {ID} is not working.add_filter('api_bearer_auth_unauthenticated_urls', 'api_bearer_auth_unauthenticated_urls_filter', 10, 2); function api_bearer_auth_unauthenticated_urls_filter($custom_urls, $request_method) { switch ($request_method) { case 'POST': $custom_urls[] = '/wp-json/wp/v2/users/register'; break; case 'GET': $custom_urls[] = '/wp-json/wp/v2/posts'; break; } return $custom_urls; }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘API whitelist problem’ is closed to new replies.