wp_heartbeat_settings( array $settings ): array

Default settings for heartbeat.

Description

Outputs the nonce used in the heartbeat XHR.

Parameters

$settingsarrayrequired

Return

array Heartbeat settings.

Source

function wp_heartbeat_settings( $settings ) {
	if ( ! is_admin() ) {
		$settings['ajaxurl'] = admin_url( 'admin-ajax.php', 'relative' );
	}

	if ( is_user_logged_in() ) {
		$settings['nonce'] = wp_create_nonce( 'heartbeat-nonce' );
	}

	return $settings;
}

Changelog

VersionDescription
3.6.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.