Skip to content

Instantly share code, notes, and snippets.

@nickalexej
Created February 21, 2023 16:03
Show Gist options
  • Save nickalexej/b8247476ace02d01ba21aeae00e6dbe1 to your computer and use it in GitHub Desktop.
Save nickalexej/b8247476ace02d01ba21aeae00e6dbe1 to your computer and use it in GitHub Desktop.
deaktiviert die restapi für nicht authentifizierte user
<?
add_filter( 'rest_authentication_errors', 'disable_rest_api' );
function disable_rest_api( $access ) {
return new WP_Error( 'rest_disabled', __( 'The WordPress REST API has been disabled on this site.' ), array( 'status' => rest_authorization_required_code() ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment