A WordPress-centric search engine for devs and theme authors



wp_refresh_heartbeat_nonces ›

Since5.0.0
Deprecatedn/a
wp_refresh_heartbeat_nonces ( $response )
Parameters:
  • (array) $response The Heartbeat response.
    Required: Yes
Returns:
  • (array) The Heartbeat response.
Defined at:
Codex:

Add the latest Heartbeat and REST-API nonce to the Heartbeat response.



Source

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;
}