Last active
July 20, 2024 13:18
-
-
Save ianpegg/cf7317ffbaf0714e1249d6f1deef97e5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: EggMUP: Suppress Site Status Tests | |
* Plugin URI: https://gist.github.com/ianpegg/cf7317ffbaf0714e1249d6f1deef97e5 | |
* Description: Some site status tests are useful, but some are not. | |
* Version: 1.0.1 | |
* Author: Ian Pegg | |
* Author URI: https://eggcupwebdesign.com | |
* Some site status report on matters that are not important, e.g. | |
* automatic updates being disabled when the site is under version control. | |
* This MU plugin makes it easy to disable unwanted status tests. | |
* php version 7.4.15 | |
* | |
* @category Must_Use_Plugin | |
* @package WordPress_Plugin | |
* @author Ian Pegg <[email protected]> | |
* @license GNU/GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt | |
* @link https://eggcupwebdesign.com | |
**/ | |
namespace EggCup\MUP\SuppressSiteStatus; | |
if (!defined('ABSPATH')) { | |
exit; | |
} | |
/** | |
* This script registers following functions with WP action hooks/filters: | |
*/ | |
add_filter( | |
'site_status_tests', | |
__NAMESPACE__ . '\\Suppress_Site_Status_tests', | |
10, | |
1 | |
); | |
/** | |
* Receives an array of the registered site status tests and then removes | |
* the ones that are unwanted. Returns a modified array. | |
* | |
* @param Array $Arr_tests Array of registered tests. | |
* | |
* @see WP_Site_Health->get_tests() in wp-admin/includes/class-wp-site-health.php | |
* @link https://developer.wordpress.org/reference/hooks/site_status_tests/ | |
* | |
* @return Array $Arr_tests Modified array of registered tests. | |
*/ | |
function Suppress_Site_Status_tests(Array $Arr_tests) | |
{ | |
// Automatic background updates: | |
unset($Arr_tests['async']['background_updates']); | |
// Loopback requests are blocked by some hosts to prevent misuse: | |
unset($Arr_tests['async']['loopback_requests']); | |
// Automatic theme and plugin updates: | |
unset($Arr_tests['direct']['plugin_theme_auto_updates']); | |
if ('production' !== wp_get_environment_type()) { | |
/** | |
* Yes, of course we have debugging enabled in development mode. | |
* We don't need to be warned about this! | |
*/ | |
unset($Arr_tests['direct']['debug_enabled']); | |
} | |
return $Arr_tests; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment