钩子文档

admin_email_check_interval

💡 云策文档标注

概述

admin_email_check_interval 是一个 WordPress 过滤器,用于控制重定向用户到管理员邮箱确认屏幕的时间间隔。通过此过滤器,开发者可以自定义或禁用重定向行为。

关键要点

  • 过滤器名称:admin_email_check_interval
  • 参数:$interval(整数类型,以秒为单位,默认值为 6 个月)
  • 返回 0 可禁用重定向
  • 引入版本:WordPress 5.3.0

代码示例

/**
 * Disable site admin email verification
 */
add_filter( 'admin_email_check_interval', '__return_false' );
/**
 * Lower the admin email check interval down to 3 months.
 */
add_filter( 'admin_email_check_interval', static function ( $interval ) {
	// Check if the interval has the default value of 6 months and if so, lower it to 3 months.
	if ( 6 * MONTH_IN_SECONDS === $interval ) {
		$interval = 3 * MONTH_IN_SECONDS;
	}

	// Return the adjusted interval.
	return $interval;
} );

📄 原文内容

Filters the interval for redirecting the user to the admin email confirmation screen.

Description

If 0 (zero) is returned, the user will not be redirected.

Parameters

$intervalint
Interval time (in seconds). Default is 6 months.

Source

$admin_email_check_interval = (int) apply_filters( 'admin_email_check_interval', 6 * MONTH_IN_SECONDS );

Changelog

Version Description
5.3.0 Introduced.

User Contributed Notes

  1. Skip to note 4 content

    /**
     * Lower the admin email check interval down to 3 months.
     */
    add_filter( 'admin_email_check_interval', static function ( $interval ) {
    	// Check if the interval has the default value of 6 months and if so, lower it to 3 months.
    	if ( 6 * MONTH_IN_SECONDS === $interval ) {
    		$interval = 3 * MONTH_IN_SECONDS;
    	}
    
    	// Return the adjusted interval.
    	return $interval;
    } );