blond woman checking phone and using computer

How to Add Custom Admin Notices in WordPress

When you’re a WordPress website owner or a plugin/theme author, admin notices offer an efficient way to communicate with users through simple alerts and messages. However, if you’ve never used them before, you might be wondering how to create custom admin notices in WordPress. 

The good news is that there are multiple solutions available. One way to create custom WordPress admin notices is by manually editing your site’s code. Alternatively, if you want a less technical method, you also have the option of using a plugin. 

In this post, we’ll discuss the benefits of adding custom admin notices in WordPress. Then we’ll walk you step-by-step through how to do it, both with and without a plugin. Let’s get started!

What Are the Benefits of Custom Admin Notices?

WordPress admin notices are useful tools that you can use to display important alerts and messages to your users. Custom admin notices enable you to:

  • Quickly and easily display useful information across your site, including admin reminders
  • Help new users navigate the WordPress admin area with ease, including for multi-author sites
  • Display success, warning, and error messages in the admin area
  • Provide feedback and guidance to users 

Custom admin notices enable you to send out dismissible notifications that can be color-coded based on the type of message. For example, you can use red for warnings and errors, green for success messages, and blue for informative notices.

How to Add a Custom Admin Notice to WordPress: No Plugin

If you’re comfortable working with code and want as much flexibility and control as possible, you can add custom admin notices in WordPress without using a plugin. Let’s take a look at how to do that in two steps.

Step 1: Add Code to the functions.php File

To manually add a custom admin notice in WordPress, locate and open the functions.php file for your WordPress theme. Then add the following code snippet:

function general_admin_notice(){
    global $pagenow;
    if ( $pagenow == 'options-general.php' ) {
         echo '<div class="notice notice-warning is-dismissible">
             <p>This is an example of a notice that appears on the settings page.</p>
add_action('admin_notices', 'general_admin_notice');

This displays a notice with a yellow border on your settings page, which looks like this:

In the above code, the $pagenow variable is used to detect the page, and the following condition verifies whether the current page should display the notice. You can use notice-error, notice-warning, notice-success, or notice-info to create your custom admin notice.

Step 2: Edit Code to Display Messages Only to Authors 

If you want to configure the notice so it only displays for the ‘author’ user role, you can do so by adding the following code snippet to your functions.php file:

function author_admin_notice(){
    global $pagenow;
    if ( $pagenow == 'index.php' ) {
    $user = wp_get_current_user();
    if ( in_array( 'author', (array) $user->roles ) ) {
    echo '<div class="notice notice-info is-dismissible">
          <p>Click on <a href="edit.php">Posts</a> to start writing.</p>
add_action('admin_notices', 'author_admin_notice');

In the above code, you’ll notice the added function for detecting the user role. Now, the admin custom notice will display like this, but only for authors:

You can use these code snippets as a template for creating your own custom admin notice in WordPress, substituting or adding any conditions, hooks, and filters to meet your needs.

How to Add a Custom Admin Notice to WordPress: With a Plugin

If you’re looking for a simpler method than editing your site’s code, or you don’t need much in terms of flexibility, you can also add a custom admin notice in WordPress by using a plugin. 

Let’s take a look at how this process works.

Step 1: Download and Install the Appropriate Plugin

The first step is to download a plugin that lets you add custom admin notices in WordPress, such as KJM Admin Notices:

After you download it from the WordPress Plugin Directory, upload the plugin to your site (Plugins > Add New > Upload Plugin). Then install and activate it.

Step 2: Configure the Plugin Settings

The next step is to enable the “KJM Admin Notices” option on the plugin’s settings page. Navigate to Settings > KJM Admin Notices:

Check the boxes to activate KJM Admin Notices, and create a custom post type for adding and editing custom admin notices:

On this page, you can also select the option to email users when a notice is published, and enable comments. Select Save Changes when you’re done here. 

Step 3: Create a Custom Admin Notice

Next, hover over the Notices menu item that was added to your WordPress admin dashboard, and select Add Notice:

Similar to creating a regular post or page in WordPress, you can enter a title and description for the admin notice:

To the right, under Notice Cats, select a category for the notification:

Choose the category you want to use for this custom admin notice.

Step 4: Add User Roles That Will See This Notice

After you’ve filled in the notification’s details and selected a category, scroll down to the Show Notice To Roles section:

Select which user roles you want to see this notification. In the following section, you can further customize the notice, for example by hiding the dismiss button or changing the background and text colors:

When you’re done, click on the Publish button:

That’s it! You’ve now created a WordPress custom admin notice.

Explore WP Engine’s Developer Resources

WordPress admin notices are a useful way to display information, alerts, and messages to your users. Whether you’re a plugin or theme author, or just an individual site owner, you can create custom admin notices by manually editing your WordPress theme’s functions.php file, or by using a plugin such as KJM Admin Notices

However, for your WordPress admin notices to be most effective, it’s important that all aspects of your website and admin area are optimized. At WP Engine, we offer quality hosting plans that can help you deliver an exceptional digital experience to your customers!

Get started.

Build faster, protect your brand, and grow your business with a WordPress platform built to power remarkable online experiences.