最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

wp admin - Disable the administration email address verification (new in 5.3)

programmeradmin1浏览0评论

In 5.3 a new function was introduced, on login you are reminded to confirm or update the administration email address of the site. Is it possible to disable this completely?

I don't want to have this in my multisite.

In 5.3 a new function was introduced, on login you are reminded to confirm or update the administration email address of the site. Is it possible to disable this completely?

I don't want to have this in my multisite.

Share Improve this question edited Nov 23, 2019 at 23:42 birgire 68k7 gold badges120 silver badges252 bronze badges asked Nov 23, 2019 at 8:37 jockebqjockebq 4631 gold badge6 silver badges18 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 3

This new feature was added in 5.3 from core ticket #46349

Currently (in 5.3) we have [src] in wp-login.php:

 /**
  * Filters the interval for redirecting the user to the admin email confirmation screen.
  * If `0` (zero) is returned, the user will not be redirected.
  *
  * @since 5.3.0
  *
  * @param int Interval time (in seconds).
  */
  $admin_email_check_interval = (int) apply_filters( 'admin_email_check_interval', 6 * MONTH_IN_SECONDS );

  if ( $admin_email_check_interval > 0 ) {
     update_option( 'admin_email_lifespan', time() + $admin_email_check_interval );
  }
  wp_safe_redirect( $redirect_to );
  exit;

and also the logic [src]:

$admin_email_lifespan = (int) get_option( 'admin_email_lifespan' );

// If `0` (or anything "falsey" as it is cast to int) is returned, the user will not be redirected
// to the admin email confirmation screen.
/** This filter is documented in wp-login.php */
$admin_email_check_interval = (int) apply_filters( 'admin_email_check_interval', 6 * MONTH_IN_SECONDS );
if ( $admin_email_check_interval > 0 && time() > $admin_email_lifespan ) {
    $redirect_to = add_query_arg( 'action', 'confirm_admin_email', wp_login_url( $redirect_to ) );
}

So we can disable the screen by filtering the admin email checking interval to zero with a (must-use) plugin like:

<?php /** Plugin Name: WPSE-353167: Disable Admin Email Checking Screen **/
add_filter( 'admin_email_check_interval', '__return_zero' );

Here __return_zero() is a core helper function that returns the zero integer. We could also return values that are not greater than zero when converted to an integer (e.g. false, null, '0', ... ).

There's also an open ticket #48153 to make this more flexible regarding the capability filtering.

Here are the published the dev notes.

发布评论

评论列表(0)

  1. 暂无评论