Support » Fixing WordPress » Code snippet to only hide update notifications

  • Hello all,

    A question. I added some code to wp-config.php to hide all update messages for clients. I manage all websites with MainWP.
    I use this code:

    define('DISALLOW_FILE_EDIT',true); // theme, plugin
    define('DISALLOW_FILE_MODS',true); // core, plugin

    Only thing; this also makes it impossible to install new plugins for my clients. For some that’s oke, but others want to install plugins. Now with this code the install button is gone.
    Is there a snippets that hides only the update notifications in de admin panel?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Felipe Santos

    (@felipeloureirosantos)

    Hi there,

    You could try this:

    define('DISABLE_NAG_NOTICES', true);

    It won’t always work as some plugins might create their own notices, and it just works on WordPress native notice.

    The only way you could deactivate them at all might be changing the manage_options capabilities, but it will affect other ways as well.

    Felipe Santos

    (@felipeloureirosantos)

    Besides that, you could also take a look on their CSS and use the display: none.

    If the solution above doesn’t help you, so I can help you this other way.

    Hello Felipe,

    Thanks for helping. Too bad define('DISABLE_NAG_NOTICES', true); didn’t work.
    Very strange this isn’t a default define in WordPress.
    Maybe I’ll use the

    define('DISALLOW_FILE_EDIT',true); // theme, plugin
    define('DISALLOW_FILE_MODS',true); // core, plugin

    anyway. I can deactivate the snippet per website. But nicer would be if I just could use one snippet for all websites.

    • This reply was modified 6 months, 2 weeks ago by Tom van M.
    Felipe Santos

    (@felipeloureirosantos)

    You could try this as well:

    add_action('admin_enqueue_scripts', 'hidenotice_admin_theme_style');
    add_action('login_enqueue_scripts', 'hidenotice_admin_theme_style');
    
    function hidenotice_admin_theme_style() {
       echo '<style>.update-nag, .updated, .error, .is-dismissible { display: none !important; }</style>';
    }

    Thanks, I will try!

    Felipe Santos

    (@felipeloureirosantos)

    You are welcome! 🙂

    Hello Felipe,

    It turns out I can easily exclude websites from the first snippet in MainWP, so I will try to use this first. https://www.youtube.com/watch?v=I1eLxUnV2IA

    Is there a way to exclude a user by mailadress of a code snippet?

    • This reply was modified 6 months, 2 weeks ago by Tom van M.
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Code snippet to only hide update notifications’ is closed to new replies.