Closed halounsbury closed 2 months ago
I tried searching wp.org docs today but didn't find any info on hiding specific site health alerts. Maybe one of you will be able to track this down?
@blogtutor So I dug into this, and there's no quick way to hide the items. The items are added dynamically and don't have a CSS ID or class we can use to hide them (the content div does but not the header, so you can't fully remove it). The hooks and filters I've found are only for adding to the list, not editing the list (https://developer.wordpress.org/reference/hooks/debug_information/).
I did find the JS Object 'SiteHealth' that we may be able to edit to remove them but the Site Health page loads with Ajax and the tests are run at that time to gather the results. Some of the tests take a few seconds to show up so the base recommendations show up and then a couple others load as the test finishes so it would be hard to tap into this and remove them.
AN ALTERNATIVE
I was thinking what if instead we added a notice or alert (like we are doing for WP Rocket) to the page that gives our point of view on the items. We can make it a thing where the friendly neighborhood nerd is giving you our thoughts. Something more proactive than the Help Widget. So it can either be a popup/tooltip with the nerdpress emoji button next to the item that opens a pop up or tooltip with the information or link to our blog post on our thoughts on the matter.
Not sure if this will prevent users from contacting us but would definitely be more proactive and could possibly deter it.
@CNoemi94 Thanks for digging into this. Before we give up on it completely, maybe we should ask in the Make WordPress Slack?
But beyond that, I think your idea is solid. And, frankly, it maybe a little more "NerdPressy" since it's less heavy-handed.
@blogtutor Sounds good! I'll see what they say and in the meantime switch to the WP Rocket task.
Found the right filter for this:
function remove_background_updates_test( $tests ) {
unset( $tests['direct']['persistent_object_cache'] );
return $tests;
}
add_filter( 'site_status_tests', 'remove_background_updates_test' );
Which of these are we looking to hide?
Seems like the DMARC and default theme issues are no longer listed.
Also, it may be good to hide "Background Updates Not Working"
So I have:
@halounsbury Are there more?
Persistent Object Cache and Comment Pagination, yes.
Background updates refers to security auto-updates. So I think we actually want to keep that. It shows as "Passed" on site that allow minor updates only. So I think it's fine to leave.
What if we try to incorporate this code into ours. So we can select what we show or don't on a per-site basis... Also setting default exclusions... https://plugins.trac.wordpress.org/browser/site-health-manager/trunk/site-health-manager.php
@CNoemi94 are you working on this one? I can take a look otherwise.
@ecotechie Yes, I saw that plugin. Not sure if it'll add bloat, though.
The reason for this was to remove things we don't generally recommend doing, which applies to all sites.
Is there a use case for making this any more than that?
@halounsbury I removed the Background Updates from the list so only Persistent Object Cache and Comment Pagination are hidden and submitted a PR. https://github.com/blogtutor/blog-tutor-support/pull/336
Would this work?
That works!
There are some issues and recommended improvements in the WordPress Site Health Tool that we don't agree with and that we'd like to hide.
These include (but may not be limited to):