<div style="text-align:center"><img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==" fifu-lazy="1" fifu-data-sizes="auto" fifu-data-srcset="https://i2.wp.com/www.awordpresscommenter.com/wp-content/uploads/2022/10/new-cache-site-health-checks-in-wordpress-6-1.png?ssl=1&w=75&resize=75&ssl=1 75w, https://i2.wp.com/www.awordpresscommenter.com/wp-content/uploads/2022/10/new-cache-site-health-checks-in-wordpress-6-1.png?ssl=1&w=100&resize=100&ssl=1 100w, https://i2.wp.com/www.awordpresscommenter.com/wp-content/uploads/2022/10/new-cache-site-health-checks-in-wordpress-6-1.png?ssl=1&w=150&resize=150&ssl=1 150w, https://i2.wp.com/www.awordpresscommenter.com/wp-content/uploads/2022/10/new-cache-site-health-checks-in-wordpress-6-1.png?ssl=1&w=240&resize=240&ssl=1 240w, https://i2.wp.com/www.awordpresscommenter.com/wp-content/uploads/2022/10/new-cache-site-health-checks-in-wordpress-6-1.png?ssl=1&w=320&resize=320&ssl=1 320w, https://i2.wp.com/www.awordpresscommenter.com/wp-content/uploads/2022/10/new-cache-site-health-checks-in-wordpress-6-1.png?ssl=1&w=500&resize=500&ssl=1 500w, https://i2.wp.com/www.awordpresscommenter.com/wp-content/uploads/2022/10/new-cache-site-health-checks-in-wordpress-6-1.png?ssl=1&w=640&resize=640&ssl=1 640w, https://i2.wp.com/www.awordpresscommenter.com/wp-content/uploads/2022/10/new-cache-site-health-checks-in-wordpress-6-1.png?ssl=1&w=800&resize=800&ssl=1 800w, https://i2.wp.com/www.awordpresscommenter.com/wp-content/uploads/2022/10/new-cache-site-health-checks-in-wordpress-6-1.png?ssl=1&w=1024&resize=1024&ssl=1 1024w, https://i2.wp.com/www.awordpresscommenter.com/wp-content/uploads/2022/10/new-cache-site-health-checks-in-wordpress-6-1.png?ssl=1&w=1280&resize=1280&ssl=1 1280w, https://i2.wp.com/www.awordpresscommenter.com/wp-content/uploads/2022/10/new-cache-site-health-checks-in-wordpress-6-1.png?ssl=1&w=1600&resize=1600&ssl=1 1600w" width="1600" height="694" fifu-data-src="https://i2.wp.com/www.awordpresscommenter.com/wp-content/uploads/2022/10/new-cache-site-health-checks-in-wordpress-6-1.png?ssl=1" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="New cache Site Health checks in WordPress 6.1" title="New cache Site Health checks in WordPress 6.1" srcset="https://i2.wp.com/www.awordpresscommenter.com/wp-content/uploads/2022/10/new-cache-site-health-checks-in-wordpress-6-1.png?ssl=1 1600w, https://www.awordpresscommenter.com/wp-content/uploads/2022/10/new-cache-site-health-checks-in-wordpress-6-1-300x130.png 300w, https://www.awordpresscommenter.com/wp-content/uploads/2022/10/new-cache-site-health-checks-in-wordpress-6-1-1024x444.png 1024w, https://www.awordpresscommenter.com/wp-content/uploads/2022/10/new-cache-site-health-checks-in-wordpress-6-1-768x333.png 768w, https://www.awordpresscommenter.com/wp-content/uploads/2022/10/new-cache-site-health-checks-in-wordpress-6-1-1536x666.png 1536w" sizes="(max-width: 1600px) 100vw, 1600px" /></div><div>
<p>As part of the WordPress 6.1 release, the <a href="https://make.wordpress.org/performance/">Performance Team</a> has added two Site Health checks (Persistent Object Cache and Page Cache). These checks were previously tested in the <a href="https://wordpress.org/plugins/performance-lab/">Performance Lab plugin</a>. You can read more about them in the original <a href="https://make.wordpress.org/core/2022/07/13/proposal-persistent-object-cache-and-full-page-cache-site-health-checks/">proposal</a>.</p>
<p>Both checks will run only in a production environment.</p>
<h2>Persistent Object Cache</h2>
<p>This new check determines whether the site uses a persistent object cache or not and recommends it if it makes sense for the site. It also links to a <a href="https://wordpress.org/support/article/optimization/#persistent-object-cache">support resource</a> created for the check.</p>
<p>A few filters have been included aiming for hosting providers to provide more specific steps regarding their environment.</p>
<p>Hosts may use the <code>site_status_persistent_object_cache_url</code> filter to replace the original WordPress guide with their own guide.</p>
<div class="wp-block-syntaxhighlighter-code ">
<pre class="brush: php; title: ; notranslate">
/**
 * Filter the Persistent object cache URL.
 */
add_filter( 'site_status_persistent_object_cache_url', function() {
	return 'https://awesomewphosting.com/optimization/persistent-object-cache';
} );
</pre>
</div>
<p>Hosts may use the <code>site_status_persistent_object_cache_notes</code> filter to customize the notes to recommend their preferred object cache solution.</p>
<div class="wp-block-syntaxhighlighter-code ">
<pre class="brush: php; title: ; notranslate">
/**
 * Update the persistent object cache notes.
 */
add_filter( 'site_status_persistent_object_cache_notes', function( $notes ) {
	$notes = __( 'The updated notes can go here as text.', 'text-domain' );

	return $notes;
} );
</pre>
</div>
<p>The <code>site_status_persistent_object_cache_thresholds</code> filter allows modifying the thresholds above WordPress considers using a persistent object cache beneficial.</p>
<div class="wp-block-syntaxhighlighter-code ">
<pre class="brush: php; title: ; notranslate">
/**
 * Override the whole $thresholds array, or any specific indexes as required.
 */
add_filter( 'site_status_persistent_object_cache_thresholds', function( $thresholds ) {
	$thresholds = array(
		'alloptions_count' => 600,
		'alloptions_bytes' => 200000,
		'comments_count' => 2000,
		'options_count' => 2000,
		'posts_count' => 2000,
		'terms_count' => 2000,
		'users_count' => 2000,
	);

	return $thresholds;
} );
</pre>
</div>
<p>Alternatively, <code>site_status_should_suggest_persistent_object_cache</code> is a short-circuit filter that allows using entirely custom logic to determine whether a persistent object cache would make sense for the site.</p>
<div class="wp-block-syntaxhighlighter-code ">
<pre class="brush: php; title: ; notranslate">
/**
 * Opt in for suggesting the persistent object cache
 */
add_filter( 'site_status_should_suggest_persistent_object_cache', '__return_true' );
</pre>
</div>
<p>For additional context on this new check, see <a href="https://core.trac.wordpress.org/ticket/56040" target="_blank" rel="noreferrer noopener">#56040</a>.</p>
<h2>Full Page Cache</h2>
<p>This new check determines whether the site is using a full page cache solution and if the response time is acceptable.</p>
<p>It also adds a couple of filters aiming for hosting companies to customize the response threshold and add their own cache headers to be detected. </p>
<p>The <code>site_status_good_response_time_threshold</code> filter allows modifying the current threshold of 600ms. Everything below this will be considered acceptable.</p>
<div class="wp-block-syntaxhighlighter-code ">
<pre class="brush: php; title: ; notranslate">
/**
 * Filter the response time threshold
 */
add_filter( 'site_status_good_response_time_threshold', function() {
	return 200;
} );
</pre>
</div>
<p>Additional custom cache headers ( and optionally their verification callbacks) can be added through the <code>site_status_page_cache_supported_cache_headers</code> filter.</p>
<div class="wp-block-syntaxhighlighter-code ">
<pre class="brush: php; title: ; notranslate">
/**
 * Filter the page cache supported cache headers
 * $cache_headers contains List of client caching headers and their (optional) verification callbacks.
 */
add_filter( 'site_status_page_cache_supported_cache_headers', function( $cache_headers ) {
	// Add new header to the existing list.
	$cache_headers['cf-cache-status'] = static function ( $header_value ) {
		return false !== strpos( strtolower( $header_value ), 'hit' );
	};
	return $cache_headers;
});
</pre>
</div>
<p>For additional context on this new check, see <a href="https://core.trac.wordpress.org/ticket/56041">#56041</a>.</p>
<p class="has-text-align-right"><em>Thanks to <a href="https://profiles.wordpress.org/flixos90/" class="mention"><span class="mentions-prefix">@</span>flixos90</a>, <a href="https://profiles.wordpress.org/milana_cap/" class="mention"><span class="mentions-prefix">@</span>milana_cap</a>, </em><a href="https://profiles.wordpress.org/spacedmonkey/" class="mention"><span class="mentions-prefix">@</span>spacedmonkey</a><em> for peer review, and <a href="https://profiles.wordpress.org/pushpakpop/" class="mention"><span class="mentions-prefix">@</span>pushpakpop</a> for the code examples.</em></p>
</p>
<p class="o2-appended-tags"><a href="https://make.wordpress.org/core/tag/6-1/" class="tag"><span class="tag-prefix">#</span>6-1</a>, <a href="https://make.wordpress.org/core/tag/core-site-health/" class="tag"><span class="tag-prefix">#</span>core-site-health</a>, <a href="https://make.wordpress.org/core/tag/dev-notes/" class="tag"><span class="tag-prefix">#</span>dev-notes</a>, <a href="https://make.wordpress.org/core/tag/dev-notes-6-1/" class="tag"><span class="tag-prefix">#</span>dev-notes-6-1</a>, <a href="https://make.wordpress.org/core/tag/performance/" class="tag"><span class="tag-prefix">#</span>performance</a>, <a href="https://make.wordpress.org/core/tag/performance-lab/" class="tag"><span class="tag-prefix">#</span>performance-lab</a>, <a href="https://make.wordpress.org/core/tag/site-health/" class="tag"><span class="tag-prefix">#</span>site-health</a></p>
</div>

A new ecommerce contender has entered the WordPress space. This week, WPManageNinja officially launched FluentCart,…
The WP Minute is stepping into education. The publication best known for its interviews, podcasts,…
AI-powered site builders are having a moment in WordPress, and 10Web is the latest company…
For as long as Aaron Edwards and Joshua Dailey have known each other, they’ve been…
A U.S. magistrate judge has moved to rein in the escalating discovery battle between WP…
Ollie’s “game-changing” Menu Designer plugin is moving toward inclusion in WordPress core. Anne McCarthy says…