wp_auth_check_load

Load the auth check for monitoring whether the user is still logged in.

Description

wp_auth_check_load(); 

Can be disabled with remove_action( admin_enqueue_scripts,, wp_auth_check_load );

This is disabled for certain screens where a login screen could cause an inconvenient interruption. A filter called can be used for fine-grained control.


Usage

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

Defined (1)

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

/wp-includes/functions.php  
  1. function wp_auth_check_load() { 
  2. if ( ! is_admin() && ! is_user_logged_in() ) 
  3. return; 
  4.  
  5. if ( defined( 'IFRAME_REQUEST' ) ) 
  6. return; 
  7.  
  8. $screen = get_current_screen(); 
  9. $hidden = array( 'update', 'update-network', 'update-core', 'update-core-network', 'upgrade', 'upgrade-network', 'network' ); 
  10. $show = ! in_array( $screen->id, $hidden ); 
  11.  
  12. /** 
  13. * Filters whether to load the authentication check. 
  14. * Passing a falsey value to the filter will effectively short-circuit 
  15. * loading the authentication check. 
  16. * @since 3.6.0 
  17. * @param bool $show Whether to load the authentication check. 
  18. * @param WP_Screen $screen The current screen object. 
  19. */ 
  20. if ( apply_filters( 'wp_auth_check_load', $show, $screen ) ) { 
  21. wp_enqueue_style( 'wp-auth-check' ); 
  22. wp_enqueue_script( 'wp-auth-check' ); 
  23.