Description
Bug Description
On my local development environment, I'm seeing a Site Health test failure for Performance:
Your site does not serve static assets with an effective caching strategy
This is an false positive because it is intentional that my development environment not have an effective caching strategy for assets, as changes to files should be available whenever I reload the page.
I suggest this test either be omitted when wp_get_environment_type()
returns local
or development
, or that the status
be changed from recommended
to be left as good
on a production
or staging
environment.
Here's some plugin code that removes the erroneous test on local
/development
:
add_filter(
'site_status_tests',
static function ( array $tests ): array {
if ( in_array( wp_get_environment_type(), array( 'local', 'development' ), true ) ) {
// Static assets are expected to not have effective cache headers in non-production/staging environments.
unset( $tests['direct']['effective_asset_cache_headers'] );
}
return $tests;
},
100
);
Screenshots

Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done 😃