The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
Need Snippet | Disa...
 
Share:
Notifications
Clear all

Need Snippet | Disable WP Admin Notice(s)

5 Posts
3 Users
0 Reactions
2,647 Views
Posts: 88
Topic starter
(@aerostar)
Estimable Member
Joined: 5 years ago

Good Day!

This is not a bug report, only a request.

There are occasions when your plugin displays notifications in our WP dashboard (all pages). These notices are in addition to the ones displayed in your plugin dashboard. Certainly, a quirk in your plugin.

Can you provide a snippet that deletes your notices everywhere, except in your plugin dashboard? (a nice challenge for your developers). These notices can be a nag. As you know, over time, many have complained about these nagging site-wide notices generated by plugins.

Currently, we're using code below. Works well, but disables ALL notices. We need one just for your plugin.

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>';
}

Thank you!

4 Replies
Asti
Posts: 7664
 Asti
Support
(@asti)
Illustrious Member
Joined: 7 years ago

Hi @aerostar,

We don't follow you well. Could you please clarify a bit? What message do you mean? 

Reply
3 Replies
(@aerostar)
Joined: 5 years ago

Estimable Member
Posts: 88

@asti,

Many plugins display admin (nag) notices (green, yellow, red) when there's a conflict, general issue, or a license has expired. We have learned that your plugin displays these notices on all WP back-end pages when this occurs, instead of being displayed only on the WP main dashboard or your plugin dashboard.

So, back to my request above, can you provide a snippet (PHP code) that deletes or restricts these admin notices to your plugin's dashboard? The code provided above deletes the nag notices presented by all plugins, which is not desirable nor beneficial.

We can accomplish the above with the Disable Admin Notices plugin, but we prefer a simple code from you since we already have too many plugins. We would add your code to our functions.php file or via Code Snippets (which we already have installed).

Thank you!

Reply
(@aerostar)
Joined: 5 years ago

Estimable Member
Posts: 88

@asti,

In lieu of a snippet, perhaps you can introduce the "clean-up" at your next convenient plugin revision.

Cheers!

Reply
(@stefsterhb)
Joined: 4 years ago

New Member
Posts: 1

@aerostar you can simply add another selector to that style rule. Just look in console to get the selector and add it with a comma and you'll be all set.

Reply
Share: