WordPress开发者和主题制作者的搜索引擎



wp_heartbeat_settings ›

Since3.6.0
已弃用n/a
wp_heartbeat_settings ( $settings )
参数:
  • (array) $settings
    Required: Yes
返回:
  • (array) $settings
定义在:
文档:

Default settings for heartbeat

Outputs the nonce used in the heartbeat XHR



源码

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