Skip to content

Instantly share code, notes, and snippets.

Created November 26, 2015 22:44
What would you like to do?
Completely disable WordPress REST API
add_filter( 'rest_enabled', '_return_false' );
add_filter( 'rest_jsonp_enabled', '_return_false' );
Copy link

The rest_enabled filter hook is deprecated and doesn't work anymore since WP 4.7. So WP rest API will still be accessible with this gist in place.

Use the hook rest_authentication_errors to manage access to the api.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment