Disable REST API Links

remove_action( ‘xmlrpc_rsd_apis’, ‘rest_output_rsd’ ); remove_action( ‘wp_head’, ‘rest_output_link_wp_head’ ); remove_action( ‘template_redirect’, ‘rest_output_link_header’, 11 );Continue reading

Disable WordPress REST API

add_filter( ‘rest_authentication_errors’, function ( $access ) { return new WP_Error( ‘rest_disabled’, __( ‘The WordPress REST API has been disabled.’ ), array( ‘status’ => rest_authorization_required_code(), ) ); } );Continue reading