Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend core's Autoloaded Options Site Health test if present (in WP 6.6) #1298

Merged
merged 3 commits into from
Jun 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
mukeshpanchal27 marked this conversation as resolved.
Show resolved Hide resolved
* @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' );
Loading