Make WordPress Core

Changeset 52088


Ignore:
Timestamp:
11/09/2021 11:05:32 PM (3 years ago)
Author:
peterwilsoncc
Message:

Login and Registration: Improve messaging for invalid log-out nonces.

Clarify messaging of when wp_nonce_ays('log-out') is called due to an invalid log out nonce. The HTML title now describes the action being taken rather than using the generic text "something went wrong".

Props davidkryzaniak, hellofromTonya, peterwilsoncc.
Fixes #52600.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r52066 r52088  
    34703470 */
    34713471function wp_nonce_ays( $action ) {
     3472    // Default title and response code.
     3473    $title         = __( 'Something went wrong.' );
     3474    $response_code = 403;
     3475
    34723476    if ( 'log-out' === $action ) {
    3473         $html = sprintf(
     3477        $title = sprintf(
    34743478            /* translators: %s: Site title. */
    34753479            __( 'You are attempting to log out of %s' ),
    34763480            get_bloginfo( 'name' )
    34773481        );
     3482        $html        = $title;
    34783483        $html       .= '</p><p>';
    34793484        $redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
     
    34953500    }
    34963501
    3497     wp_die( $html, __( 'Something went wrong.' ), 403 );
     3502    wp_die( $html, $title, $response_code );
    34983503}
    34993504
Note: See TracChangeset for help on using the changeset viewer.