Skip to content

Commit

Permalink
Revert "Use alt method"
Browse files Browse the repository at this point in the history
This reverts commit 48a78b8.
  • Loading branch information
Mamaduka committed Jan 15, 2025
1 parent 48a78b8 commit ad8c299
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/compat/wordpress-6.8/ajax-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

0 comments on commit ad8c299

Please sign in to comment.