wp_nonce_ays()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
wp_nonce_ays( string $action )
Описание
Если для действия задано пояснительное сообщение об одноразовом защитном коде, оно будет показано вместе с сообщением «Вы уверены?».
Оригинал (английский)
If the action has the nonce explain message, then it will be displayed along with the “Are you sure?” message.
Параметры
$action
string
обязательный
Исходный код
wp-includes/functions.php:3690
function wp_nonce_ays( $action ) {
// Default title and response code.
$title = __( 'An error occurred.' );
$response_code = 403;
if ( 'log-out' === $action ) {
$title = sprintf(
/* translators: %s: Site title. */
__( 'You are attempting to log out of %s' ),
get_bloginfo( 'name' )
);
$redirect_to = $_REQUEST['redirect_to'] ?? '';
$html = $title;
$html .= '</p><p>';
$html .= sprintf(
/* translators: %s: Logout URL. */
__( 'Do you really want to <a href="%s">log out</a>?' ),
wp_logout_url( $redirect_to )
);
} else {
$html = __( 'The link you followed has expired.' );
if ( wp_get_referer() ) {
$wp_http_referer = remove_query_arg( 'updated', wp_get_referer() );
$wp_http_referer = wp_validate_redirect( sanitize_url( $wp_http_referer ) );
$html .= '</p><p>';
$html .= sprintf(
'<a href="%s">%s</a>',
esc_url( $wp_http_referer ),
__( 'Please try again.' )
);
}
}
wp_die( $html, $title, $response_code );
}
История изменений
| Версия | Описание |
|---|---|
| 2.0.4 | Introduced. |

