[wp-trac] [WordPress Trac] #62101: Add a filter to customize the URL for page caching check in Site Health
WordPress Trac
noreply at wordpress.org
Mon Sep 23 21:01:03 UTC 2024
#62101: Add a filter to customize the URL for page caching check in Site Health
-------------------------------------+-------------------------------------
Reporter: zetrider | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Site Health | Version:
Severity: normal | Keywords: has-patch has-unit-
Focuses: administration, | tests
performance |
-------------------------------------+-------------------------------------
In the ''check_for_page_caching'' function, which is used to check if a
page is being cached in the Site Health panel, the request is made to the
URL returned by home_url( '/' ). This limits the caching check to the
homepage only.
I propose adding a filter ''apply_filters(
'site_status_persistent_page_cache_url', home_url( '/' ) )'' that would
allow developers to modify the URL used to check for caching. This would
provide more flexibility in checking the caching status of different pages
and scenarios.
{{{#!php
<?php
$caching_url = apply_filters( 'site_status_persistent_page_cache_url',
home_url( '/' ) );
$http_response = wp_remote_get( $caching_url, compact( 'sslverify',
'headers' ) );
}}}
**Benefits:**
1. Flexibility in caching checks:
This allows checking the caching status of any page on the site, not just
the homepage. It can be useful for sites where specific pages (like
product catalogs or popular posts) experience high traffic.
2. Support for multilingual sites:
For multilingual sites, this enables checking the caching of different
language versions, ensuring proper caching across all localized versions.
3. Testing and debugging:
In testing and development environments, you can configure caching checks
for test pages without affecting the homepage.
4. Dynamic URL modification:
Depending on conditions (time of day, user type, site configuration), the
URL for caching checks can be dynamically altered, providing deeper
insights into caching performance.
5. External caching systems check:
The filter can be used to check caching at the CDN level or other external
proxy systems, which is especially useful for sites leveraging Cloudflare
or other external caching systems.
**Conclusion:**
The proposal to add a filter for customizing the URL in the page caching
check within the Site Health panel offers more flexible and adaptable
options for administrators and developers. It enhances control over
caching, both at the system and external caching levels, and allows
tailoring checks for specific site pages based on their importance.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62101>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list