From ad8c29937bdeb323e87142f954ddd373de63738d Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Wed, 15 Jan 2025 12:20:08 +0400 Subject: [PATCH] Revert "Use alt method" This reverts commit 48a78b81ad12f1caa8e1b7ed783918c01cc9c404. --- lib/compat/wordpress-6.8/ajax-actions.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/compat/wordpress-6.8/ajax-actions.php b/lib/compat/wordpress-6.8/ajax-actions.php index 1cba32cbf7729..24388b7f3b911 100644 --- a/lib/compat/wordpress-6.8/ajax-actions.php +++ b/lib/compat/wordpress-6.8/ajax-actions.php @@ -9,15 +9,14 @@ * Handles renewing the REST API nonce via AJAX. * * @since 5.3.0 - * @since 6.8.0 Returns an error if a renewed nonce isn't valid. + * @since 6.8.0 Returns error when session token is missing. */ function gutenberg_ajax_rest_nonce() { - $nonce = wp_create_nonce( 'wp_rest' ); - $result = wp_verify_nonce( $nonce, 'wp_rest' ); - if ( ! $result ) { + $token = wp_get_session_token(); + if ( empty( $token ) ) { wp_send_json_error( null, rest_authorization_required_code() ); } - exit( $result ); + exit( wp_create_nonce( 'wp_rest' ) ); } add_action( 'wp_ajax_rest-nonce', 'gutenberg_ajax_rest_nonce', 0 );