Based on the number of comments we received on WordPress admin notices being abused, it’s clear that a number of you feel the same way I do. Thanks to the healthy discussion that took place, I learned several new things about admin notices I’d like to share with you.
Themes Do it Too
While the crux of the article focuses on plugins being the largest offender, the issue also applies to themes hosted in and outside of the WordPress theme directory. In one of the more extreme examples I discovered, earlier this year, Redux Framework added an admin notice that informed users of a new commercial extension.
When users questioned how to remove the notices, Redux Framework developers responded by creating a commercial extension.
For $59 a year, the extension removes admin notices, ads from the options panel, and the dashboard news widget. Even though the notices and ads are only displayed when the framework’s dev mode is enabled, it seems like a ridiculous way to generate revenue.
While researching for this article, I discovered that Dovy Paukstys, Co-Founder and lead developer of Redux Framework, is in the process of removing advertising from current and future admin notices. Paukstys provided the Tavern with the following statement:
As a fellow developer, I can see how frustrating an admin notice can be when used as an ad. To support the requests of the community, we will no longer use admin notices to advertise premium features. We will use admin notices for their intended purpose, to inform and educate our users.
We hope that other frameworks, plugins, and products will follow suit.
WP Notification Center
Inspired by our article, WPBeginner looks into whether or not WordPress needs a notification center. As it turns out, there are a couple of different plugins and projects in the works aiming to solve this problem.
The WP Notification Center plugin, developed by Barry Kooij and Never5, adds a notification center to WordPress. This plugin moves admin notices to a central location freeing up valuable screen real-estate.
When activated, a notifications area is added to the admin bar. This tells you the number of notices available and provides quick viewing access. The messages are also color coded to easily tell the difference between update and error messages.
Links within the notice take you to the corresponding admin page to view more details. Unfortunately, you can’t dismiss notices from the admin toolbar without navigating to the links within them. According to Kooij, dismissing notices is a difficult problem to fix.
The admin notices are added in code so I can’t stop them from being added. That means I would need to store what notices are dismissed and check all added notices on every admin page load to filter out the ones that are dismissed.
It’s the other way around from an ideal situation, where a notice would be added to the database and I can simply remove it when it’s dismissed.
As for the possibility of getting WP Notification Center into core, “I would love to write a patch for core that would set this up the right way,” Kooij said. “That would eventually involve deprecating and stop displaying notifications that are being added the old way.”
If you’re interested in tackling this problem or would like to contribute to other facets of the project, you can find it on GitHub where issues and pull requests are welcomed.
WordPress Notifications API
During the WordPress Core developer chat back in January, John Blackbourn proposed a Notifications API that would replace
wp_mail() with an extensible API. The API could be hooked into by developers to send notifications via webhooks that would enable Slack and IM notifications. There would also be UI added so users and admins can choose which individual notifications and types to opt-in/out of.
The API is not directly relevant to admin notices but it’s possible they could be connected in the future. Blackbourn plans to publish a detailed blog post outlining the idea in-depth within the next week or two.
Jetpack handles notifications via a module that adds an icon to the toolbar. Notifications include, Likes, Comments, Follows, and the ability to moderate and reply to comments.
I use this notifications area all the time to moderate and respond to comments. It’s convenient and usually loads items quickly. However, I’m not sure how well the interface would work if admin notices from themes and plugins were added.
Subscribers Can Possibly See Admin Notices
One of the most surprising things I’ve learned is that users who are subscribers can possibly see admin notices. On the surface, this doesn’t make sense as subscribers don’t have the capabilities necessary to act on notices. I tested this theory on the WP Tavern test site by activating both Yoast SEO and the All in One SEO plugin.
This is what I see while logged in as an admin.
This is the same dashboard while logged in as a subscriber.
As you can see, the notices disappear when logged in as a subscriber. While I initially thought this was an issue in core, it appears to be more of a developer issue. JS Morisset, who commented on the original article has a possible explanation:
The word ‘admin’ (for notices) could be interpreted in two ways — either they’re admin / back-end notices, or they’re administrator notices.
I’ve always understood that they are the former (notices displayed on the admin back-end), and can be seen by any / all back-end users, so I use ‘current_user_can()’ in my own code to display different kinds of messages. Maybe this is more of a developer awareness issue than a core WP issue.
While I have not analyzed the code in the plugins I tested, the current_user_can() capability check would explain why admins see notices while subscribers do not.
What I’d Like to See in a Centralized WordPress Notifications Center
Admin notices are a great way for developers to inform users of important information. But with all the notices bombarding site administrators these days, there’s a need for an organizational user interface to manage them all. When considering the types of notifications to allow and display, a notification center in WordPress can easily turn into a deep rabbit hole.
What I’d like to see is a notification center that notifies me of core, plugin, and theme updates in addition to whatever notices those items generate. I also want it to tell me about errors on the site. These notifications should be in an easy-to-use interface that’s quick to access. Notifications should be dismissable or have a status where they can be marked as read.
As seen above, there are plenty of people and projects working on solutions to this problem. What would be your ideal WordPress notifications center?