Disable All Admin Notices individually
function disable_all_admin_notices() { remove_all_actions(‘admin_notices’); } add_action(‘admin_init’, ‘disable_all_admin_notices’);Continue reading
Join 2,000,000+ Professionals who use WPCode to Future-Proof Their Websites!
function disable_all_admin_notices() { remove_all_actions(‘admin_notices’); } add_action(‘admin_init’, ‘disable_all_admin_notices’);Continue reading
function exclude_pages_from_search($query) { if ($query->is_search) { $query->set(‘post_type’, ‘post’); // Exclude pages by changing ‘post’ to ‘page’ } return $query; } add_filter(‘pre_get_posts’,’exclude_pages_from_search’);Continue reading
add_action(‘admin_init’, function () { // Redirect any user trying to access comments page global $pagenow; if ($pagenow === ‘edit-comments.php’) { wp_safe_redirect(admin_url()); exit; } // Remove comments metabox from dashboard remove_meta_box(‘dashboard_recent_comments’, ‘dashboard’, ‘normal’); // Disable support for comments and trackbacks in…Continue reading
.woocommerce-cart .cross-sells {display:none;}Continue reading
// Disable the Plugin and Theme Editor if ( ! defined( ‘DISALLOW_FILE_EDIT’ ) ) { define( ‘DISALLOW_FILE_EDIT’, true ); }Continue reading
add_filter(‘wp_sitemaps_enabled’, ‘__return_false’);Continue reading
// Remove Tools Submenu Item for Site Health. add_action( ‘admin_menu’, function () { remove_submenu_page( ‘tools.php’, ‘site-health.php’ ); } ); // Prevent direct access to the Site Health page. add_action( ‘current_screen’, function () { $screen = get_current_screen(); if ( ‘site-health’ ===…Continue reading
add_filter( ‘wp_lazy_loading_enabled’, ‘__return_false’ );Continue reading
// Disable auto-update emails. add_filter( ‘auto_core_update_send_email’, ‘__return_false’ ); // Disable auto-update emails for plugins. add_filter( ‘auto_plugin_update_send_email’, ‘__return_false’ ); // Disable auto-update emails for themes. add_filter( ‘auto_theme_update_send_email’, ‘__return_false’ );Continue reading
// Disable auto-update emails. add_filter( ‘auto_core_update_send_email’, ‘__return_false’ ); // Disable auto-update emails for plugins. add_filter( ‘auto_plugin_update_send_email’, ‘__return_false’ ); // Disable auto-update emails for themes. add_filter( ‘auto_theme_update_send_email’, ‘__return_false’ );Continue reading