Toolbelt Tidies WordPress Plugin and Theme Admin Notifications – WordPress Tavern
It’s a tale as old as, well, WordPress. Ben Gillbanks noticed a conversation where someone thought that admin notices were getting out of hand. Enter another developer’s attempt to address this problem. With a few code additions to his Toolbelt plugin, he had a working solution to stop the madness: the Tidy Notifications module.
Despite the early promise of the WP Notify project last year, it still feels like we are no closer to addressing the overuse of the current admin notice system in WordPress. In reality, it is not so much a system as a hook that developers can use for literally anything. It is the Wild West of the WordPress admin. No rules. No order. And no proper API for standardizing how notices work.
WP Notify still exists on GitHub and continues to move along at its own pace, but there is no guarantee that it will ever land in the core platform. Sometimes, the best thing a developer can do is solve the existing problem and hope that WordPress follows along down the road with a better solution.
I am already tidying admin notifications with Toolbelt on my development install. My primary use case is to hide the non-dismissible notice from the Gutenberg plugin that I have a Full Site Editing theme installed — is there not a guideline against such notices? I did not suddenly forget that I was using such a theme between the 999th and 1,000th time the reminder appeared on every admin screen of my installation.
The Tidy Notifications system in Toolbelt neatly tucks all admin notices under a bell icon in the admin toolbar. It also displays the number of notifications.
It makes the WordPress admin so clutter-free that I do not know how I have lived without it before. I cannot imagine going back.
The only problem with Toolbelt’s solution is that there is no way to distinguish between essential notices and those that should be tucked away. WordPress letting you know that your post was successfully updated is an important notice that should not be hidden. However, a plugin author drumming up five-star reviews, yeah, that should not be front and center.
Having two systems would be beneficial. The existing
admin_notices hook in WordPress should be used for letting users know the outcome of their actions or actions that they should take. The post editor, which does not use page reloads or make the hook available, has replaced this with the snackbar popup system. These necessary notices have their place.
However, WordPress has no built-in system for non-essential notices. This leaves plugin and theme authors with two options: bundle an entirely custom notification apparatus with each extension or just use the
admin_notices hook. The latter is the more efficient use of developer resources.
Of course, we have had this conversation before. Just shy of a year ago, I wrote a post titled Are Plugin Authors to Blame for the Poor Admin Notices Experience? In the comments, WordPress project lead Matt Mullenweg posited that the solution to unwanted notifications is not to build an inbox, comparing WordPress to cell phones. He said that app store guidelines were likely more impactful to user happiness. In general, I agree with that concept. Setting down a few directory UI and UX rules would not hurt.
Given the more recent push to loosen guidelines for the theme directory, that does not seem to be in the cards. Admin notices were not one of the guardrails, the safety net of “must-haves” from the Themes Team.
The admin notice spam WordPress users see today most commonly comes from plugins and not themes. Why? It is not because theme authors care more about user happiness levels. It is because the theme review guidelines over the years have been strict. Anything too flamboyant gets the hammer.
The WordPress Themes Team even has a custom guideline-friendly, drop-in class that themers can use.
The plugin and theme directories have taken far different stances on admin notices, and it shows. When the Themes Team moves to minimal checks, there may not be anything to stop themers from competing for the most obnoxious admin notice award. Game on, plugin authors.
“Unwanted” notifications may even be the wrong terminology. Often, they are “unwanted right now.” Sometimes, folks might want to read a message — just later. I am still holding out hope that we will have a notifications/messages inbox in WordPress one day. One that is entirely controlled by the user.
Until then, I may just stick with the Tidy Notifications module in Toolbelt. There are many other handy components in it too.
Credit: Source link