diff --git a/wp-includes/functions.php b/wp-includes/functions.php index b07ecb7f4d9d16a50914f0fcdca1c03660c39e61..a9c329362e56c98d2a4f4438c78f400b89085e78 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -7633,3 +7633,16 @@ function is_php_version_compatible( $required ) { function wp_fuzzy_number_match( $expected, $actual, $precision = 1 ) { return abs( (float) $expected - (float) $actual ) <= $precision; } + +/* AI modifica per disattivare in parte le wp Json rest API */ + + +add_filter( 'rest_authentication_errors', function( $result ) { + if ( ! empty( $result ) ) { + return $result; + } + if ( ! is_user_logged_in() ) { + return new WP_Error( '401', 'not allowed.', array('status' => 401) ); + } + return $result; +});