Have you ever found yourself distracted by notifications while managing your WordPress site? Find out how to hide them easily with this simple guide.
WordPress is a powerful platform, but sometimes the notifications can make the administration experience a bit confusing, especially if you’re trying to keep the screen clean and organized. Fortunately, there is a simple solution to this problem. In this quick guide, I’ll show you how you can hide all notifications in WordPress, making your administration experience more focused and smooth.
Hiding notifications for all users (including administrators)
To hide all notifications, you just need to add a small piece of code to your functions.php file in WordPress. Here’s how:
add_action('admin_head', 'hide_admin_notices');
function hide_admin_notices() {
remove_all_actions('admin_notices');
}
If you want to ensure that only administrators see the notifications, you can include a user role check. Here’s how:
add_action('admin_head', 'hide_admin_notices');
function hide_admin_notices() {
global $current_user;
$user_id = $current_user->ID;
if (!user_can($user_id, 'administrator')) {
remove_all_actions('admin_notices');
}
}
Try these codes and enjoy a cleaner, distraction-free WordPress administration experience!
Ready to simplify your WordPress administration life? Check out the full article and learn how to hide notifications!
See you next time!