Códigos php para el functions.php de tu theme para eliminar y/o bloquear el acceso al json de la api rest de wordpress.
Si quieres eliminar el tag del head de tu página:
function remove_api_rest () { remove_action( 'wp_head', 'rest_output_link_wp_head', 10 ); } add_action( 'after_setup_theme', 'remove_api_rest' );
Y si por motivos de seguridad quieres también que se bloquee el acceso al json para cuando no estas logueado:
function disable_api_rest( $access ) { if( ! is_user_logged_in() ) { return new WP_Error( 'rest_cannot_access', __( 'Necesitas estar logueaddo para tener acceso a la API REST.', 'disable-json-api' ), array( 'status' => rest_authorization_required_code() ) ); } return $access; } add_filter( 'rest_authentication_errors', 'disable_api_rest' );
Agradezco tu comentario 🤘