wp_heartbeat_settings( array $settings )

Default settings for heartbeat

Description

Outputs the nonce used in the heartbeat XHR

Parameters

$settings

(array) (Required)

Return

(array) Heartbeat settings.

Source

File: wp-includes/general-template.php

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

Version Description
3.6.0 Introduced.

© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_heartbeat_settings