WP Notify

I just learned about a proposal from Jonathan Bossenger to implement better notifications in WordPress.

You can read up on it for yourself, but I thought it would be helpful (for myself as much as anyone) to add some context, and explain why it’s so important.

What would WP Notify do?

If added to core, WP Notify would:

1. Provide developers with a Notifications API to surface new Notifications to the user, and handle their state (e.g. “dismissed”)

2. Introduce a Unified Notification Format (fixing the current visual mess of having boxes everywhere)

3. Group notifications together in a Notifications Hub (such as a menu item in the Admin Bar)¹


Technical Part.

The current notifications in WordPress are a hack at best. You need to write all the HTML for the notification wrapper, and use a specific CSS class to get it to show up.

Something like:

add_action( 'admin_notices', function() {
	<div class="notice is-dismissible">
		<h2><?php esc_html_e( 'We come in peace.', 'my-plugin' ); ?></h2>
		<p>🖖 <?php esc_html_e( 'Live long and prosper.', 'my-plugin' ); ?></p>
	</div>
} );

That’s just to show the notice. You’ve also got to save whether the notice has been dismissed.


I’ve got some personal history tied up in WordPress notifications. Joshua Wold and I spent a lot of time designing a notifications solution for Stream (which never came to be).

Then, in 2016, I gave a talk at WordCamp Sydney containing this screenshot.

What we’re looking at here is a brand new WordPress install after installing just 5 plugins. It’s a mess!

Now, a common Notifications API in WordPress won’t fix this entirely, but it could improve it a lot. The most interesting idea is to group notifications together in the Admin Bar.

This could produce a UI similar to the way Yoast handles notifications (see the screenshot above). It would also restrict notifications to:

  • A limited amount of text (280 characters, for example)
  • An icon

Notifications in WordPress can be grouped into a few categories:

Action

The plugin wants the user to take an action (often required before the plugin can be fully functional). For example, adding an API Key to Akisment, or connecting Jetpack. Sometimes it’s an optional action, such as taking a survey.

Onboarding

The plugin wants to teach the user about a feature, and so it shows a notice (usually contextual to where the feature exists) with some help text.

Informative

The plugin has detected information about WordPress which it wants to surface to the user. For example, Yoast detecting that search engine indexing is disallowed.

Results

The user has taken an action, and the plugin wants to notify them about the result (e.g. Post Saved, or Error Saving Post).

Advertisements

The plugin wants to show the user information about a paid upgrade or a current sale (please, no!).


While grouping notifications together into a single Notifications Hub would help reduce a lot of visual clutter, not all of these notification types belong in a Notifications Hub.

HubNotification Type
Action
Onboarding
Informative
Results
Advertisements

Onboarding notifications nearly always need to be shown in context. These are typically inserted into the UI, intentionally interrupting the user journey.

Results are a little different to other notifications in that they’re not usually persistent. They only need to be shown once, and automatically dismissed. Gutenberg’s notifications implementation does this really nicely.

Advertisements could exist in a Notifications Hub, but probably won’t. These notifications are all about grabbing a user’s attention, and grouping with other notifications isn’t a great way of doing that.


Given that only a few types of Notifications that would make use of a Hub (and even then, only at the plugin developers discretion), is WP Notify worth pursuing?

To answer this, I installed the 20 most popular plugins and catalogued the notification types I encountered. By collecting this data, we can see what percentage of notifications would be “captured” in a Notifications Hub area.

Notification TypeCount%
✅ Action1033%
❌ Onboarding620%
✅ Informative930%
❌ Results27%
❌ Advertisements310%

Of all notifications that I encountered, 19 / 30 (63%) could belong in a Notifications Hub


One interesting side note: Due to the brief usage of each plugin, I’m sure I missed many “Results” notifications, such as notifications shown when saving settings.

Should WP Notify provide a method for developers to show this style of transient notification, separately to the “grouped” Notifications Hub?


If you’d like to be involved in making this proposal a reality, you can get involved by joining the #feature-notifications channel in the WordPress Slack.

This is a great opportunity to get involved in WordPress core development, especially for UX / UI designers who want to have a hugely positive impact toward a distributed and open web.


1. There is some concern that the admin bar might not be the best place to show notifications. It’s already crowded, hard to use on mobile, and sometimes hidden on the frontend.

2. In these tests, the average amount of notifications displayed (after only a few minutes of usage) is 1.5 notifications per plugin.


Posted

in