wp_auth_check

函数


wp_auth_check ( $response )
参数
  • (array)
    $response
    The Heartbeat response.
    Required:
返回值
  • (array) The Heartbeat response with ‘wp-auth-check’ value set.
定义位置
  • wp-includes/functions.php
    , line 7173
引入
3.6.0
弃用

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

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.

function wp_auth_check( $response ) {
	$response['wp-auth-check'] = is_user_logged_in() && empty( $GLOBALS['login_grace_period'] );
	return $response;
}