Skip to content

Commit

Permalink
Merge pull request #1298 from WordPress/fix/1274
Browse files Browse the repository at this point in the history
Extend core's Autoloaded Options Site Health test if present (in WP 6.6)
  • Loading branch information
mukeshpanchal27 committed Jun 24, 2024
2 parents 2b2bebc + e4775cf commit 20f22ba
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
* @return array{direct: array<string, array{label: string, test: string}>} Amended tests.
*/
function perflab_aao_add_autoloaded_options_test( array $tests ): array {
// Bail early if check already registered in WordPress core version 6.6.
if ( isset( $tests['direct']['autoloaded_options'] ) ) {
return $tests;
}

$tests['direct']['autoloaded_options'] = array(
'label' => __( 'Autoloaded options', 'performance-lab' ),
'test' => 'perflab_aao_autoloaded_options_test',
Expand Down Expand Up @@ -111,3 +116,16 @@ function perflab_aao_admin_notices(): void {
}
}
add_action( 'admin_notices', 'perflab_aao_admin_notices' );

/**
* Extends the health check description that merged in WordPress 6.6.
*
* @since n.e.x.t
*
* @param string $description Description message when autoloaded options bigger than threshold.
* @return string Extended health check description.
*/
function perflab_aao_extend_core_check( string $description ): string {
return $description . perflab_aao_get_autoloaded_options_table() . perflab_aao_get_disabled_autoloaded_options_table();
}
add_filter( 'site_status_autoloaded_options_limit_description', 'perflab_aao_extend_core_check' );

0 comments on commit 20f22ba

Please sign in to comment.