wp_auth_check

Check whether a user is still logged in, for the heartbeat.

Description

(array) wp_auth_check( (array) $response ); 

Send a result that shows a log-in box if the user is no longer logged in, or if their cookie is within the grace period.

Returns (array)

$response The Heartbeat response with 'wp-auth-check' value set.

Parameters (1)

0. $response (array)
The Heartbeat response.

Usage

  1. if ( !function_exists( 'wp_auth_check' ) ) { 
  2. require_once ABSPATH . WPINC . '/functions.php'; 
  3.  
  4. // The Heartbeat response. 
  5. $response = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wp_auth_check($response); 
  9.  

Defined (1)

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

/wp-includes/functions.php  
  1. function wp_auth_check( $response ) { 
  2. $response['wp-auth-check'] = is_user_logged_in() && empty( $GLOBALS['login_grace_period'] ); 
  3. return $response;