Skip to content

Instantly share code, notes, and snippets.

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

This comment has been minimized.

Copy link

@stijnjanmaat stijnjanmaat commented Oct 19, 2017

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