wpseek.com
A WordPress-centric search engine for devs and theme authors



wp_heartbeat_settings › WordPress Function

Since3.6.0
Deprecatedn/a
wp_heartbeat_settings ( $settings )
Parameters:
  • (array) $settings
    Required: Yes
Returns:
  • (array) Heartbeat settings.
Defined at:
Codex:

Default settings for heartbeat.

Outputs the nonce used in the heartbeat XHR.


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