Skip to content

Instantly share code, notes, and snippets.

@lumpysimon
Created November 26, 2015 22:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lumpysimon/d66e21db2177e4b9cf4d to your computer and use it in GitHub Desktop.
Save lumpysimon/d66e21db2177e4b9cf4d to your computer and use it in GitHub Desktop.
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