Make WordPress Core

Changeset 50939


Ignore:
Timestamp:
05/20/2021 11:08:15 AM (3 years ago)
Author:
Clorith
Message:

Site Health: Skip REST tests during scheduled events.

This change fixes a false positive that would appear during scheduled events, by only running the REST test when a user visits the Site Health page, meaning an active session is available.

The test checking if the REST API is available, includes a parameter for context=edit to make sure the block editor can function properly. This means a user session with editor capabilities is required for the test to pass, which is not the case during a scheduled event.

Props szaqal21, TimothyBlynJacobs, hermpheus.
Fixes #52112.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-site-health.php

    r50916 r50939  
    23622362        if ( function_exists( 'rest_url' ) ) {
    23632363            $tests['direct']['rest_availability'] = array(
    2364                 'label' => __( 'REST API availability' ),
    2365                 'test'  => 'rest_availability',
     2364                'label'     => __( 'REST API availability' ),
     2365                'test'      => 'rest_availability',
     2366                'skip_cron' => true,
    23662367            );
    23672368        }
     
    27302731
    27312732        foreach ( $tests['direct'] as $test ) {
     2733            if ( ! empty( $test['skip_cron'] ) ) {
     2734                continue;
     2735            }
    27322736
    27332737            if ( is_string( $test['test'] ) ) {
Note: See TracChangeset for help on using the changeset viewer.