Force REST API Authentication for each request method
You can’t really apply authentication based directly on whether the request is GET or otherwise, but can forcefully apply authentication requirements globally in that manner, if you like. I’ve been quite verbose with the code to illustrate what’s happening: add_filter( ‘rest_authentication_errors’, function ( $error ) { /** * If it’s a WP_Error, leave it as … Read more