Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Disables the WordPress API.
- */
- function disable_wp_json() {
- add_filter( 'rest_authentication_errors', function( $access ){
- return new WP_Error( 'rest_cannot_access', 'Unauthorized access.', array( 'status' => 403 ) );
- } );
- // also remove actions added by wp-includes/default-filters.php
- remove_action( 'wp_head', 'rest_output_link_wp_head' );
- remove_action( 'wp_head', 'wp_oembed_add_discovery_links' );
- remove_action( 'template_redirect', 'rest_output_link_header' );
- }
- disable_wp_json();
Advertisement
Add Comment
Please, Sign In to add comment