Skip to content

Instantly share code, notes, and snippets.

@lumpysimon
Created November 26, 2015 22:44
Embed
What would you like to do?
Completely disable WordPress REST API
add_filter( 'rest_enabled', '_return_false' );
add_filter( 'rest_jsonp_enabled', '_return_false' );
@stijnjanmaat
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