wp_refresh_heartbeat_nonces() WordPress Function

The wp_refresh_heartbeat_nonces() function is used to refresh the heartbeat nonces for a user. This is useful for when a user's session has expired and they need to re-login.

wp_refresh_heartbeat_nonces( array $response ) #

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


Parameters

$response

(array)(Required)The Heartbeat response.


Top ↑

Return

(array) The Heartbeat response.


Top ↑

Source

File: wp-admin/includes/misc.php

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


Top ↑

Changelog

Changelog
VersionDescription
5.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.