显示“你确定”消息以确认正在执行的操作。
原型
wp_nonce_ays( string $action )
描述
如果操作有nonce说明消息,那么它将与“你确定吗?”一起显示。信息。
参数
$action
(string)
(Required)
随机动作。
源文件
路径:wp-includes/functions.php
<?php
...
function wp_nonce_ays( $action ) {
if ( 'log-out' == $action ) {
$html = sprintf(
/* translators: %s: site name */
__( 'You are attempting to log out of %s' ),
get_bloginfo( 'name' )
);
$html .= '</p><p>';
$redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
$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() ) {
$html .= '</p><p>';
$html .= sprintf( '<a href="%s">%s</a>',
esc_url( remove_query_arg( 'updated', wp_get_referer() ) ),
__( 'Please try again.' )
);
}
}
wp_die( $html, __( 'Something went wrong.' ), 403 );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/wp_nonce_ays/