Commit 3f6ac49a authored by Kevin Cristiano's avatar Kevin Cristiano 🌎

check WP versions before adding filter Clean up to single function

parent 11d10176
<?php
/*
Plugin Name: Disable Health Check
Version: 1.0
Version: 1.0.1
Plugin URI: https://tadpole.cc
Description: Turns off Health Check Tests
Author: Kevin Cristiano
Author URI: https://tadpole.cc
*/
function tc_remove_async_tests( $tests ) {
unset( $tests['async'] );
return $tests;
}
add_filter( 'site_status_tests', 'tc_remove_async_tests' );
global $wp_version;
function tc_remove_direct_tests( $tests ) {
function tc_remove_tests( $tests ) {
unset( $tests['async'] );
unset( $tests['direct'] );
return $tests;
}
if ( version_compare( $wp_version, '5.2', '>=' ) ) {
add_filter( 'site_status_tests', 'tc_remove_tests' );
}
add_filter( 'site_status_tests', 'tc_remove_direct_tests' );
function tc_remove_hcmenu() {
remove_submenu_page( 'tools.php', 'site-health.php' );
}
add_action( 'admin_menu', 'tc_remove_hcmenu' );
\ No newline at end of file
if ( version_compare( $wp_version, '5.2', '>=' ) ) {
add_action( 'admin_menu', 'tc_remove_hcmenu' );
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment