Search code examples
phpwordpresswordpress-rest-api

Create Public Endpoint for Wordpress API


I am getting a 401 Unauthorized error when I try to access a public endpoint I made, through POSTMAN.

enter image description here enter image description here



Though, if I log into the wp-admin and access it via Browser, it works fine.

enter image description here



I already added '__return_true' as the permission callback, as the WP API Handbook suggested, but it still does not work when accessed publicly.

enter image description here

How do I make the API endpoint public/accessible to anonymous users?


Solution

  • I ended up uninstalling plugins for the site, and it turns out a plugin called "password protect" causing this error.