wp_heartbeat_settings() WordPress Function
The wp_heartbeat_settings() function allows you to modify the way that the WordPress Heartbeat API works. This function is useful for plugins and themes that need to change the default behavior of the API.
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; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
3.6.0 | Introduced. |