Created
November 6, 2022 15:43
-
-
Save AndreFCAmorim/37686553ed4a92843d4b379638666d4b to your computer and use it in GitHub Desktop.
Disable WordPress REST API on WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
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(), | |
) | |
); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment