
跨版本PHP代码转换终极教程
wp_auth_check_load ( No parameters )
wp_auth_check_load: 这个函数用于在WordPress仪表盘上加载与认证有关的功能。
加载auth检查,以监测用户是否仍在登录。
可以用remove_action( ‘admin_enqueue_scripts’, ‘wp_auth_check_load’ )来禁用。
对于某些登录界面可能导致不方便的中断的情况下,可以禁用这个功能。一个叫做{@see ‘wp_auth_check_load’}的过滤器可以用于细粒度的控制。
function wp_auth_check_load() { if ( ! is_admin() && ! is_user_logged_in() ) { return; } if ( defined( 'IFRAME_REQUEST' ) ) { return; } $screen = get_current_screen(); $hidden = array( 'update', 'update-network', 'update-core', 'update-core-network', 'upgrade', 'upgrade-network', 'network' ); $show = ! in_array( $screen->id, $hidden, true ); /** * Filters whether to load the authentication check. * * Returning a falsey value from the filter will effectively short-circuit * loading the authentication check. * * @since 3.6.0 * * @param bool $show Whether to load the authentication check. * @param WP_Screen $screen The current screen object. */ if ( apply_filters( 'wp_auth_check_load', $show, $screen ) ) { wp_enqueue_style( 'wp-auth-check' ); wp_enqueue_script( 'wp-auth-check' ); add_action( 'admin_print_footer_scripts', 'wp_auth_check_html', 5 ); add_action( 'wp_print_footer_scripts', 'wp_auth_check_html', 5 ); } }