Created
October 22, 2022 15:45
-
-
Save jmau111/49999a67aec0e200079e832db5a49087 to your computer and use it in GitHub Desktop.
Remove unwanted stuff in WordPress
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: WP remove features | |
Description: Remove native features and Woocommerce functionalities that might annoy you | |
Version: 1.0 | |
*/ | |
defined( "ABSPATH" ) | |
or die( "trying" ); | |
// woocommerce UIs and features | |
add_filter( 'woocommerce_admin_disabled', '__return_true' ); | |
add_filter( 'woocommerce_background_image_regeneration', '__return_false' ); | |
add_filter( 'woocommerce_resize_images', '__return_false' ); | |
// privacy: don't record IPs in comments | |
add_filter( 'pre_comment_user_ip', '__return_empty_string' ); | |
// the settings in admin menu "permalinks" won't rewrite the .htaccess anymore | |
add_filter( "flush_rewrite_rules_hard", "__return_false" );// @see https://developer.wordpress.org/reference/hooks/flush_rewrite_rules_hard/ | |
// site health check | |
add_action( 'admin_menu', function() { | |
remove_submenu_page( 'tools.php', 'site-health.php' ); | |
} ); | |
add_action( 'wp_dashboard_setup', function() { | |
remove_meta_box( 'dashboard_site_health', 'dashboard', 'normal' ); | |
} ); | |
// ban wp-admin/site-health.php | |
add_action( 'load-site-health.php', function() { | |
wp_die( __( 'Sorry, you are not allowed to access site health information.' ), '', 403 ); | |
} ); | |
// admin email check | |
// @since 5.3 | |
add_filter( 'admin_email_check_interval', '__return_zero' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment