wp_refresh_heartbeat_nonces

函数
wp_refresh_heartbeat_nonces ( $response )
参数
  • (array) $response The Heartbeat response.
    Required:
返回值
  • (array) The Heartbeat response.
定义位置
相关方法
wp_refresh_post_nonceswp_refresh_metabox_loader_nonceswp_refresh_post_lockwp_create_noncewp_ajax_heartbeat
引入
5.0.0
弃用
-

wp_refresh_heartbeat_nonces: 这个函数用来刷新WordPress heartbeat API使用的nonces,它负责后台AJAX请求。

将最新的Heartbeat 和REST-API nonce添加到Heartbeat 响应中。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_refresh_heartbeat_nonces( $response ) {
// Refresh the Rest API nonce.
$response['rest_nonce'] = wp_create_nonce( 'wp_rest' );
// Refresh the Heartbeat nonce.
$response['heartbeat_nonce'] = wp_create_nonce( 'heartbeat-nonce' );
return $response;
}
function wp_refresh_heartbeat_nonces( $response ) { // Refresh the Rest API nonce. $response['rest_nonce'] = wp_create_nonce( 'wp_rest' ); // Refresh the Heartbeat nonce. $response['heartbeat_nonce'] = wp_create_nonce( 'heartbeat-nonce' ); return $response; }
function wp_refresh_heartbeat_nonces( $response ) {
	// Refresh the Rest API nonce.
	$response['rest_nonce'] = wp_create_nonce( 'wp_rest' );

	// Refresh the Heartbeat nonce.
	$response['heartbeat_nonce'] = wp_create_nonce( 'heartbeat-nonce' );

	return $response;
}

常见问题

FAQs
查看更多 >