-
Notifications
You must be signed in to change notification settings - Fork 382
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
Improve object cache warning notice with host-specific instructions #1216
Comments
@westonruter, Are you aware of a way for a plugin or theme to surface the hosting platform? Agreed, that could be extremely useful for us here! |
No, but usually there are some signals that can move looked at to sniff out the hosting platform. For example on Pantheon the |
As @schlessera suggested, it would be good to engage with the WordPress hosting community to put an authoritative documentation in the handbook. |
Another resource to refer to: https://scalewp.io/object-caching/ |
Documentation here: https://make.wordpress.org/hosting/handbook/handbook/performance/ |
The handbook performance page is missing the guidance on which specific plugins to use, and what object caching is available on each host. So that would be a natural next step for that Object Cache section. |
@schlessera Do you know if the hosting team has this on their roadmap? |
another question would be whether or not this is even possible on for example a plain webhoster and if not just let the user supress the notification as there's nothing the user can do anyway |
We've agreed this is not feasible to do in a general way. It is up to hosts to add this information via Here's an example for how a host can override the test actions to include not only host-specific documentation link but also a button that could be used to enable object caching on their platform: add_filter(
'site_status_test_result',
function ( $test_result ) {
if (
isset( $test_result['test'], $test_result['status'] )
&& 'amp_persistent_object_cache' === $test_result['test']
&& 'recommended' === $test_result['status']
) {
$enable_button = sprintf(
'<button class="button button-secondary" id="foo-host-enable-object-caching" type="button">%s</button>',
esc_html__( 'Enable Object Caching', 'foo-host-object-caching' )
);
$learn_more_link = sprintf(
'<a href="%1$s" target="_blank" rel="noopener noreferrer">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
esc_url( 'https://foo-host.example.com/object-cache/' ),
esc_html__( 'Learn more about persistent object caching', 'foo-host-object-cache' ),
/* translators: The accessibility text. */
esc_html__( '(opens in a new tab)', 'foo-host-object-cache' )
);
$test_result['actions'] = "<p>$enable_button</p> <p>$learn_more_link</p>";
}
return $test_result;
},
20
);
add_action( 'admin_enqueue_scripts', function ( $hook_suffix ) {
if ( 'site-health.php' !== $hook_suffix ) {
return;
}
wp_enqueue_script( 'foo-host-enable-object-caching', 'https://foo-host.example.com/enable-object-caching.js', [], '0.1', true );
} ); The recommended site test result then looks like this: |
I've opened a new issue for this and re-scoped it: #5780 |
There is currently a notice on the AMP settings page that links to the Persistent Caching page on the Codex:
The codex page is not very informative. It would be best if we detected the hosting environment and linked off to their respective support docs on enabling object caching, for example:
This information should be exposed in the Site Health check.
The text was updated successfully, but these errors were encountered: