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.

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
scroll top