Wordpress

Hide all WordPress Admin Notifications – Messages

With this snippet, you can programmatically hide all notifications from the admin pages in wordpress.

Many times, these notifications can become annoying, especially when they are ads from the plugins you use.

If you want only a specific user to be the one receiving the notifications and they are hidden from everyone else, you can replace this:

            if ( is_user_admin() ) {

with:

    $current_user = wp_get_current_user();
    
    if ( $current_user->user_login == 'username' ) {
    
// Hide WordPress Admin Notifications programmatically function pr_disable_admin_notifications() { global $wp_filter; if ( is_user_admin() ) { if ( isset( $wp_filter['user_admin_notices'] ) ) { unset( $wp_filter['user_admin_notices'] ); } } elseif ( isset( $wp_filter['admin_notices'] ) ) { unset( $wp_filter['admin_notices'] ); } if ( isset( $wp_filter['all_admin_notices'] ) ) { unset( $wp_filter['all_admin_notices'] ); } } add_action( 'admin_print_scripts', 'pr_disable_admin_notifications' );

1 thought on “Hide all WordPress Admin Notifications – Messages”

Leave a Reply

Your email address will not be published. Required fields are marked *