Skip to content

Autoloaded Options Health Check: Disabled options reappear in Site Health after external update #1340

@mukeshpanchal27

Description

@mukeshpanchal27

Bug Description

In #1048, support for changing the autoload value for the largest autoloaded options in the Site Health check was added. However, there is a potential bug when the option value is updated through external code, meaning some external code autoloads the option.

Steps to Reproduce

Add filter code to show the site health check.

If you use WP 6.6 version, use the filter:

add_filter( 'site_status_autoloaded_options_size_limit', '__return_zero' );

If you use WP < 6.6 version, use the filter:

add_filter( 'perflab_aao_autoloaded_options_limit_size_in_bytes', '__return_zero' );
  1. Go to Admin Panel > Site Health > Autoloaded options could affect performance.
  2. Click on 'Disable autoload' for any option.
  3. Check that the option is moved to the new disabled option table and removed from the top table.
  4. Update that option through code update_option( 'option_name', 'value', true );.
  5. Reload the site health page.
  6. See the error. The option is displayed in both tables.

Screenshots

Screenshot 2024-07-10 at 6 20 49 PM

Suggested Approach

We should perform an early check in the disabled table to see if any option is autoloaded again, and if so, remove that option from perflab_aao_disabled_options so it will not show up again. Additionally, when anyone clicks on "Revert to autoload" for a duplicate option, it shows a Failed to disable autoload. error.

Metadata

Metadata

Labels

[Plugin] Performance LabIssue relates to work in the Performance Lab Plugin only[Type] BugAn existing feature is broken

Type

No type

Projects

Status

Done 😃

Relationships

None yet

Development

No branches or pull requests

Issue actions