wp_heartbeat_settings

Default settings for heartbeat.

Description

(array) wp_heartbeat_settings( (array) $settings ); 

Outputs the nonce used in the heartbeat XHR

Returns (array)

$settings

Parameters (1)

0. $settings (array)
The settings.

Usage

  1. if ( !function_exists( 'wp_heartbeat_settings' ) ) { 
  2. require_once ABSPATH . WPINC . '/general-template.php'; 
  3.  
  4. // The settings. 
  5. $settings = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wp_heartbeat_settings($settings); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/general-template.php  
  1. function wp_heartbeat_settings( $settings ) { 
  2. if ( ! is_admin() ) 
  3. $settings['ajaxurl'] = admin_url( 'admin-ajax.php', 'relative' ); 
  4.  
  5. if ( is_user_logged_in() ) 
  6. $settings['nonce'] = wp_create_nonce( 'heartbeat-nonce' ); 
  7.  
  8. return $settings;