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 響應中。

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
檢視更多 >