wp_nonce_ays

函数


wp_nonce_ays ( $action )
参数
  • (string)
    $action
    The nonce action.
    Required:
定义位置
  • wp-includes/functions.php
    , line 3565
引入
2.0.4
弃用

显示 “Are You Sure “信息以确认正在执行的动作。

如果该动作有nonce解释信息,那么它将与 “Are You Sure”信息一起显示。

function wp_nonce_ays( $action ) {
	// Default title and response code.
	$title         = __( 'Something went wrong.' );
	$response_code = 403;

	if ( 'log-out' === $action ) {
		$title = sprintf(
			/* translators: %s: Site title. */
			__( 'You are attempting to log out of %s' ),
			get_bloginfo( 'name' )
		);
		$html        = $title;
		$html       .= '

'; $redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : ''; $html .= sprintf( /* translators: %s: Logout URL. */ __( 'Do you really want to log out?' ), 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( esc_url_raw( $wp_http_referer ) ); $html .= '

'; $html .= sprintf( '%s', esc_url( $wp_http_referer ), __( 'Please try again.' ) ); } } wp_die( $html, $title, $response_code ); }