Custom WordPress Admin Notice

How to Add a Custom Admin Notice to WordPress

Have you ever forgotten to do something for your website? If your answer wasn’t yes, then you are lying. One way to avoid forgetting anything is by setting up a custom admin notice in WordPress. Think of it like setting up a sticky note in WordPress.

Luckily, it is extremely easy to set up custom admin notifications in WordPress. At least, if you are using the right plugin. Of course, there are many advantages to setting up reminders within WordPress for admins and other users.

Today I will demonstrate how to add custom admin notices in WordPress with two different methods.

Why Custom Admin Notices Can Help Your Website

You can set custom WordPress admin notices to remind your admins of anything. These are extremely beneficial in team environments. For example, you’re going on vacation and your partner is in charge of the website.

You could create notifications to remind him or her to make a page go live or update a plugin. The possibilities are endless and they can be very effective at reminding whoever has admin privileges.

WordPress admin notifications can be used to notify of many things including errors, warnings, updates, reminders, and much more. It really depends on what you want the message to be, but remember they can be very annoying if the notifications are received every hour.

An abundant amount of notifications can definitely impact the experience of your staff and newer WordPress developers.

How to Display An Admin Notice in WordPress

Adding a notice to the admin screen is relatively easy. Even the coding method shouldn’t take much effort as it’s essentially copy-and-paste while changing the message to fit your needs.

Both of these methods will work to let you show messages in the admin panel of WordPress.

Method 1: Using a Plugin to Show the Admin Notice in WordPress

First, we’ll start with the plugin method. This is much easier overall and doesn’t take a lot of effort to change the message.

This is opposed to the coding method, which requires you to change the text anytime you want to change what is shown. Altering the code each time can get quite tedious if you need a new message every day.

Step 1: Install Customize WordPress Emails and Alerts

The Customize WordPress Emails and Alerts plugin allows users to send out admin notifications through emails. It offers users a WYSIWYG editor, so you can make them as flashy as you want them to be.

But since this will mainly be used as a message to yourself, it might be overboard to do so. Overall, the plugin is very simple to use and it can be sent to any WordPress user, so it’s not exclusive to the admin.

Let’s start by clicking on Plugins and selecting the Add New option on the left-hand admin panel.

Add New Plugin

Search for Customize WordPress Emails and Alerts in the available search box. This will pull up additional plugins that you may find helpful.

Customize WordPress Emails and Alerts

Scroll down until you find the Customize WordPress Emails and Alerts plugin and click on the “Install Now” button and activate the plugin for use.

Install Now Button

Step 2: Create An Admin Notice in WordPress

With the plugin installed, you are ready to start creating notifications. To put it simply, you will use an editor to create an email that will send a message to a specific user when a specific action occurs.

So, for example, let’s say you want to send a notification to an admin account when a user role is changed. You would choose that option, send it to admin-level accounts, and create the email. It’s pretty simple, all things considered.

Let me demonstrate how to do this.

On the left-hand admin panel, click on Notifications and select the Add New option.

Add New Notification

At the top, you can add a title. In this case, I would call it “User Role Changed” but it’s just to help identify it. Below this, you will find the “Notification For” section. Use the drop-down to select what action will trigger a notification.

In this case, I am picking User Role Changed – For Admin.

Choose Notification Cause

Below this, you can customize the email formatting and if you need any additional email fields. More importantly, you can choose whom to send the notification.

You can send them to all users within a role, or you can send them to a single user. The choice is yours.

Email Recipient

Now, it’s time to actually make the email. It’s pretty standard; just add a subject and include the actual message you want to send. You can spruce it up by adding images or even write it in HTML to add more style, but that choice is yours.

Step 3: Save the Notice

Once you are happy with the notification, look on the top right side. You should see the Save Notifications box. Make sure to enable the notification and click on the “Save” button to finish.

Save Button

Method 2: Using Code in WordPress from the Admin Notice

Coding the admin notice yourself isn’t extremely difficult. However, this means you’ll need to change the code each time you want a new message.

This is why I suggest using the plugin above instead. It’s far more convenient and doesn’t require editing code, which is probably a great idea for those who don’t know what they’re doing in PHP.

Access the functions.php file of your theme. You can do this through cPanel, a File Manager plugin, or through WordPress itself through the theme file editor.

Theme Functions File

Add the following code to the functions.php file to show an admin notice in WordPress.

/**
 *Adding the Admin Notice
 */
function wpb_admin_notice_warn() {
echo '

Remember to add internal links to recently published posts!

'; } add_action( 'admin_notices', 'wpb_admin_notice_warn' );
Paste Admin Notice PHP

Save the file after pasting the code.

Once the file is saved, you can go back to the WordPress admin dashboard to see the message.

Admin Notice in WordPress Showing

In this particular code snippet, change the text between the

and

. Keep in mind that you can’t use an apostrophe within the text as the code will throw an error.

Additional Plugins to Add An Admin Notice in WordPress

Notifications are very common, and WordPress has many plugins that can help your website. Here are some plugins that I can recommend trying when you want to add custom notices in WordPress.

Admin Notice Manager

Admin Notices Manager for WordPress

The Admin Notices Manager helps you control what notifications you see in WordPress, and more importantly, add your own notifications. First, the plugin will move all admin notices to a specific location. This helps reduce their annoyance level.

Instead, you will only see them when you want to. It’s a simple, but effective tool.

WP Custom Admin Interface

WP Custom Admin Interface

The WP Custom Admin Interface plugin is all about customizing the admin area. And while it can do a lot of stuff, I just want to highlight its admin notices. It allows you to create custom admin notices for any user.

And they can even have an expiration date set for them. Thus, they will go away naturally instead of having to delete them manually.

Use An Admin Notice in WordPress to Improve Efficiency

Notifications can be a very handy tool for easily distributing specific information to certain people. This could be an error message for a person in charge of adding code to your website, or reminding a subscriber that a new piece of content or product is available when they log in.  

These can be just as useful as other tools provided by WordPress like a floating footer bar or a custom widget to display key information. Regardless of what form of distribution you use, it is essential that you find one that works and is not annoying.

It may be fine for employers to send multiple notifications to employees, but visitors are another story. They come to the website to have a good time, not to see a million notifications.

Remember to always find a balance between annoying and effective whenever you are trying to distribute information.

Who are you notifying on your website? How often do you send notifications out to subscribers?

2 thoughts on “How to Add a Custom Admin Notice to WordPress”

  1. Nice tutorial, helped me in setting a notification inside our website. Thanks sharing your WordPress knowledge, tips and tricks!

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.