wp update message on multisite

Dear,
Is it possible to show the wordpress messages only on main site and not to each subsites?
You know the way every time there is a new wp version or any other message actually... those appear on the dashboard of each subsites...
It would be good to limit those messages only to the main site dashboard.
Do you know if this is possible?
Thanks,
Paddy

  • Dimitris

    Hey there Paddy,

    hope you're doing good and thanks for reaching us! :slight_smile:

    I just created this little MU plugin for you, which detects current blog ID and inserts a little CSS rule to hide admin messages if not the main blog.
    Simply create a new PHP file in your installation like
    /wp-content/mu-plugins/remove-admin-notices.php (create the mu-plugins folder if doesn't exist) and use the following snippet in there (please mind not to have any gaps or empty lines before the opening php tag).

    <?php
    add_action('admin_head', 'remove_admin_notices', 11);
    function remove_admin_notices(){
      $blog_id = get_current_blog_id();
      if ( $blog_id != 1 ) { // change 1 to the ID of your main site if not 1
        add_action('admin_head', 'remove_admin_notices_css', 12);
      }
    }
    function remove_admin_notices_css() {
      echo '<style>
        .notice {
          display: none;
        }
      </style>';
    }

    You may also need to add some additional CSS classes apart from the ".notice" I used in my example. :wink:

    Warm regards,
    Dimitris

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.