Hide WordPress Update Notifications in Admin Panel Easily
Explanation
If you're looking to keep your WordPress admin panel tidy by hiding those pesky update notifications, this code is just what you need. Here's a simple breakdown of what it does:
- Hide Update Notifications: The code removes notifications for updates related to WordPress core, plugins, and themes. This means you won't see those alerts in your admin panel anymore.
- Disable Automatic Updates: It stops WordPress from automatically updating itself, as well as its plugins and themes. This gives you full control over when and what to update.
- Suppress Admin Notices: All admin notices are suppressed, so your dashboard stays clean and free from distractions.
By using this code, you can focus on managing your site without being constantly reminded about updates. Just remember, while hiding notifications can be convenient, it's important to regularly check for updates to keep your site secure and running smoothly.
Code
<?php
// Function to hide WordPress core, plugin, and theme update notifications
function wp_dudecom_hide_update_notifications() {
// Remove core update notifications
remove_action('admin_notices', 'update_nag', 3);
// Remove plugin update notifications
add_filter('pre_site_transient_update_plugins', '__return_null');
// Remove theme update notifications
add_filter('pre_site_transient_update_themes', '__return_null');
// Remove core update notifications
add_filter('pre_site_transient_update_core', '__return_null');
}
add_action('admin_menu', 'wp_dudecom_hide_update_notifications');
// Function to disable automatic updates
function wp_dudecom_disable_automatic_updates() {
// Disable all automatic updates
add_filter('automatic_updater_disabled', '__return_true');
// Disable core updates
add_filter('auto_update_core', '__return_false');
// Disable plugin updates
add_filter('auto_update_plugin', '__return_false');
// Disable theme updates
add_filter('auto_update_theme', '__return_false');
}
add_action('init', 'wp_dudecom_disable_automatic_updates');
// Function to suppress admin notices
function wp_dudecom_suppress_admin_notices() {
// Suppress all admin notices
remove_all_actions('admin_notices');
remove_all_actions('all_admin_notices');
}
add_action('admin_init', 'wp_dudecom_suppress_admin_notices');
?>
Instructions
To implement the code for hiding updates in the WordPress admin panel, follow these steps:
File Location: You can add the code to your theme's functions.php
file or create a custom plugin file.
Prerequisites: Ensure you have access to your WordPress site's file system, either via FTP or a file manager provided by your hosting service.
Implementation Steps:
- Access Your Site's Files: Use an FTP client or your hosting provider's file manager to access your WordPress installation files.
- Locate the
functions.php
File: Navigate towp-content/themes/your-active-theme/
and open thefunctions.php
file. Alternatively, if you prefer to use a plugin, navigate towp-content/plugins/
and create a new file, e.g.,hide-updates.php
. - Add the Code: Copy the provided code and paste it at the end of the
functions.php
file or into your new plugin file. - Save the Changes: If you're editing
functions.php
, save the file. If you're creating a plugin, save the file and ensure it has the necessary plugin header comments to be recognized by WordPress. - Activate the Plugin (if applicable): If you created a plugin, go to the WordPress admin panel, navigate to Plugins, find your new plugin, and activate it.
- Verify the Changes: Log in to your WordPress admin panel and check that update notifications and admin notices are no longer visible.
By following these steps, you can successfully hide update notifications and suppress admin notices in your WordPress admin panel. If you need assistance with this implementation or require more advanced functionality, consider reaching out to wp-dude.com for expert help.