Support » Networking WordPress » Error on multisite: health check – wp_version_check() – WordPress 5.6

  • Resolved McLibboc

    (@mclibboc)


    After updating a wordpress multisite to version 5.6 I see a critical security warning on the health check page of all subsites except the main site:

    A plugin has prevented updates by disabling wp_version_check().

    I searched where the error message originates and found that it is generated when the function test_wp_version_check_attached cannot find a filter for the function wp_version_check.

    So I checked where this filter might be set and I found the following lines in wp-includes/update.php close to the end of the file:

    
    if ( ( ! is_main_site() && ! is_network_admin() ) || wp_doing_ajax() ) {
      return;
    }
    
    add_action( 'admin_init', '_maybe_update_core' );
    add_action( 'wp_version_check', 'wp_version_check' );
    

    If I understand these lines correctly, there is a return statement before add_action( 'wp_version_check', 'wp_version_check' ); can be executed, when either is_main_site() or is_network_admin() is false. And since is_main_site() is false for all of the subsites’ health check pages, this return statement will always kick in for those.

    For testing purposes, I tried the following:

    
    if ( ( ! is_main_site() && ! is_network_admin() ) || wp_doing_ajax() ) {
      add_action( 'wp_version_check', 'wp_version_check' );
      return;
    }
    
    add_action( 'admin_init', '_maybe_update_core' );
    

    and the error message on the health check page of all subsites disappeared.

    This looks like a bug to me.

    In case it is not, I am thankful for all and any hints of how to get rid of the error.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Error on multisite: health check – wp_version_check() – WordPress 5.6’ is closed to new replies.