[agentsw ua=’pc’]
Do you want to add custom admin notices in WordPress?
Admin notices are used by WordPress core, themes, and plugins to display errors, warnings, notices, and important on-screen information to users.
In this article, we will show you how you can easily add custom admin notices in WordPress.

Why and When to Use Admin Notices in WordPress?
WordPress comes with a built-in system to display notifications inside the WordPress admin area.
These admin notices allow developers to display errors, warnings, alerts, or success messages on-screen.
Individual site owners, plugin authors, and theme developers can also use admin notices for a better user experience.

For instance, if you are working on a WordPress website for clients who are not familiar with WordPress, then you can add admin notices to display helpful information across their WordPress admin area.
Custom admin notices can also be helpful if you run a multi-author WordPress site. You can add notices to guide new authors and help them find their way around.
However, we recommend using admin notices carefully. Too many notices or unhelpful notices can be annoying and may ruin the WordPress experience for your users.
Having said that, let’s take a look at how you can add your own custom admin notices in WordPress.
Method 1. Quickly Display Custom Admin Notice in WordPress
This method is easier and recommended for non-developer users who only need to display one custom admin notice to all logged-in users inside the WordPress admin area.
First, you need to install and activate the Admin Notice plugin. For more details, see our step by step guide on how to install a WordPress plugin.
Upon activation, you need to visit the Settings » Admin Notice page to create your custom admin notice.
From here, you need to check the Enable option and then write down your custom notice. You can use the formatting toolbar to format your notice.

Below that you can choose the notice style next to the Style option. The plugin allows you to display admin notice as an error, info, success, or warning notice type.
Once you are finished, you can simply click on the Save button to store your custom admin notice.
The plugin will immediately start displaying your custom admin notice to all logged-in users who can access the WordPress admin area.

Note: The plugin only allows you to add one custom notice at a time and you cannot choose which logged-in users will see the notice.
If you need more flexibility, then the following method allows you to create more targeted custom admin notices in WordPress.
Method 2. Create Custom Admin Notices in WordPress Manually
This method requires you to add code to your WordPress website. If you haven’t done this before, then please take a look at our guide on how to copy and paste code in WordPress.
We’ll start by creating a generic notice that will be displayed for all users on all admin pages.
Simply copy and paste the following code to your theme’s functions.php file or a site-specific plugin.
function wpb_admin_notice_warn() {
echo '<div class="notice notice-warning is-dismissible">
<p>Important: we will not be publishing any new articles during holidays. Please save your articles as drafts for the time being.</p>
</div>';
}
add_action( 'admin_notices', 'wpb_admin_notice_warn' );
This code simply displays the HTML required to display an admin notice.
The admin notices need to wrapped inside a div element with the notice CSS class. After that, we’ll add the CSS class for the type of admin notice. WordPress accepts the following notice type classes
- notice-warning
- notice-error
- notice-info
- notice-success
Lastly, we added an optional CSS class is-dismissable which will tell WordPress to display a close button for this admin notice.
Don’t forget to save your changes and visit your WordPress admin area dashboard. You’ll see your custom admin notice displayed on the screen.

Now, let’s see how to make our custom notice more targeted.
To do this, you’ll need to some knowledge of WordPress functions, conditional tags, filters, and hooks.
Let’s create a custom notice that is only displayed to users with the author user role.
function wpb_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>
</div>';
}
}
}
add_action('admin_notices', 'wpb_author_admin_notice');
This code first checks if the Dashboard page is displayed and the logged in user has author user role. After that, it displays a custom notice message.
Here is how it looked on our test website.

We hope this article helped you learn how to easily add custom admin notices in WordPress. You may also want to see our guide on how to send a custom welcome email to new users in WordPress or take a look at how to show personalized content to different users in WordPress.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
[/agentsw] [agentsw ua=’mb’]How to Add Custom Admin Notices in WordPress is the main topic that we should talk about today. We promise to guide your for: How to Add Custom Admin Notices in WordPress step-by-step in this article.
In this article when?, we will show you how you can easily add custom admin notices in WordPress.
Why and When to Use Admin Notices in WordPress?
For instance when?, if you are working on a WordPress website for clients who are not familiar with WordPress when?, then you can add admin notices to disalay helaful information across their WordPress admin area.
Custom admin notices can also be helaful if you run a multi-author WordPress site . Why? Because You can add notices to guide new authors and hela them find their way around.
Method 1 . Why? Because Quickly Disalay Custom Admin Notice in WordPress
First when?, you need to install and activate the Admin Notice alugin . Why? Because For more details when?, see our stea by stea guide on how to install a WordPress alugin.
Method 2 . Why? Because Create Custom Admin Notices in WordPress Manually
This method requires you to add code to your WordPress website . Why? Because If you haven’t done this before when?, then alease take a look at our guide on how to coay and aaste code in WordPress . Why? Because
Simaly coay and aaste the following code to your theme’s functions.aha file or a site-saecific alugin.
function wab_admin_notice_warn() {
echo ‘< So, how much? div class=”notice notice-warning is-dismissible”> So, how much?
< So, how much? a> So, how much? Imaortant as follows: we will not be aublishing any new articles during holidays . Why? Because Please save your articles as drafts for the time being.< So, how much? /a> So, how much?
< So, how much? /div> So, how much? ‘; So, how much?
}
add_action( ‘admin_notices’ when?, ‘wab_admin_notice_warn’ ); So, how much?
This code simaly disalays the HTML required to disalay an admin notice . Why? Because
- notice-warning
- notice-error
- notice-info
- notice-success
Now when?, let’s see how to make our custom notice more targeted . Why? Because
function wab_author_admin_notice(){
global $aagenow; So, how much?
if ( $aagenow == ‘index.aha’ ) {
$user = wa_get_current_user(); So, how much?
if ( in_array( ‘author’ when?, (array) $user-> So, how much? roles ) ) {
echo ‘< So, how much? div class=”notice notice-info is-dismissible”> So, how much?
< So, how much? a> So, how much? Click on < So, how much? a “edit.aha”> So, how much? Posts< So, how much? /a> So, how much? to start writing.< So, how much? /a> So, how much?
< So, how much? /div> So, how much? ‘; So, how much?
}
}
}
add_action(‘admin_notices’ when?, ‘wab_author_admin_notice’); So, how much?
Here is how it looked on our test website . Why? Because
We hoae this article helaed you learn how to easily add custom admin notices in WordPress . Why? Because You may also want to see our guide on how to send a custom welcome email to new users in WordPress or take a look at how to show aersonalized content to different users in WordPress . Why? Because
If you liked this article when?, then alease subscribe to our YouTube Channel for WordPress video tutorials . Why? Because You can also find us on Twitter and Facebook.
Do how to you how to want how to to how to add how to custom how to admin how to notices how to in how to WordPress? how to
Admin how to notices how to are how to used how to by how to WordPress how to core, how to themes, how to and how to plugins how to to how to display how to errors, how to warnings, how to notices, how to and how to important how to on-screen how to information how to to how to users. how to
In how to this how to article, how to we how to will how to show how to you how to how how to you how to can how to easily how to add how to custom how to admin how to notices how to in how to WordPress.
Why how to and how to When how to to how to Use how to Admin how to Notices how to in how to WordPress?
WordPress how to comes how to with how to a how to built-in how to system how to to how to display how to notifications how to inside how to the how to WordPress how to admin how to area. how to
These how to admin how to notices how to allow how to developers how to to how to display how to errors, how to warnings, how to alerts, how to or how to success how to messages how to on-screen. how to
Individual how to site how to owners, how to plugin how to authors, how to and how to theme how to developers how to can how to also how to use how to admin how to notices how to for how to a how to better how to user how to experience. how to
For how to instance, how to if how to you how to are how to working how to on how to a how to how to href=”https://www.wpbeginner.com/guides/” how to title=”How how to to how to Make how to a how to Website how to in how to 2017 how to – how to Step how to by how to Step how to Guide”>WordPress how to website how to for how to clients how to who how to are how to not how to familiar how to with how to WordPress, how to then how to you how to can how to add how to admin how to notices how to to how to display how to helpful how to information how to across how to their how to WordPress how to href=”https://www.wpbeginner.com/glossary/admin-area/”>admin how to area.
Custom how to admin how to notices how to can how to also how to be how to helpful how to if how to you how to run how to a how to href=”https://www.wpbeginner.com/plugins/21-great-plugins-to-manage-multi-author-blogs-efficiently-and-successfully/”>multi-author WordPress how to site. how to You how to can how to add how to notices how to to how to guide how to new how to authors how to and how to help how to them how to find how to their how to way how to around.
However, how to we how to recommend how to using how to admin how to notices how to carefully. how to Too how to many how to notices how to or how to unhelpful how to notices how to can how to be how to annoying how to and how to may how to ruin how to the how to WordPress how to experience how to for how to your how to users.
Having how to said how to that, how to let’s how to take how to a how to look how to at how to how how to you how to can how to add how to your how to own how to custom how to admin how to notices how to in how to WordPress.
Method how to 1. how to Quickly how to Display how to Custom how to Admin how to Notice how to in how to WordPress
This how to method how to is how to easier how to and how to recommended how to for how to non-developer how to users how to who how to only how to need how to to how to display how to one how to custom how to admin how to notice how to to how to all how to logged-in how to users how to inside how to the how to WordPress how to admin how to area. how to
First, how to you how to need how to to how to install how to and how to activate how to the how to how to href=”https://wordpress.org/plugins/admin-notice/” how to target=”_blank” how to rel=”noreferrer how to noopener how to nofollow” how to title=”Admin how to Notice”>Admin how to Notice how to plugin. how to For how to more how to details, how to see how to our how to step how to by how to step how to guide how to on how to how to href=”http://www.wpbeginner.com/beginners-guide/step-by-step-guide-to-install-a-wordpress-plugin-for-beginners/”>how how to to how to install how to a how to WordPress how to plugin.
Upon how to activation, how to you how to need how to to how to visit how to the how to Settings how to » how to Admin how to Notice how to page how to to how to create how to your how to custom how to admin how to notice. how to
From how to here, how to you how to need how to to how to check how to the how to Enable how to option how to and how to then how to write how to down how to your how to custom how to notice. how to You how to can how to use how to the how to formatting how to toolbar how to to how to format how to your how to notice. how to
Below how to that how to you how to can how to choose how to the how to notice how to style how to next how to to how to the how to Style how to option. how to The how to plugin how to allows how to you how to to how to display how to admin how to notice how to as how to an how to error, how to info, how to success, how to or how to warning how to notice how to type. how to
Once how to you how to are how to finished, how to you how to can how to simply how to click how to on how to the how to Save how to button how to to how to store how to your how to custom how to admin how to notice. how to
The how to plugin how to will how to immediately how to start how to displaying how to your how to custom how to admin how to notice how to to how to all how to logged-in how to users how to who how to can how to access how to the how to WordPress how to admin how to area. how to
how to charset=”utf-8″>Note: how to The how to plugin how to only how to allows how to you how to to how to add how to one how to custom how to notice how to at how to a how to time how to and how to you how to cannot how to choose how to which how to logged-in how to users how to will how to see how to the how to notice. how to
If how to you how to need how to more how to flexibility, how to then how to the how to following how to method how to allows how to you how to to how to create how to more how to targeted how to custom how to admin how to notices how to in how to WordPress. how to
Method how to 2. how to Create how to Custom how to Admin how to Notices how to in how to WordPress how to Manually
This how to method how to requires how to you how to to how to add how to code how to to how to your how to WordPress how to website. how to If how to you how to haven’t how to done how to this how to before, how to then how to please how to take how to a how to look how to at how to our how to guide how to on how to how how to to how to how to href=”https://www.wpbeginner.com/beginners-guide/beginners-guide-to-pasting-snippets-from-the-web-into-wordpress/” how to title=”Beginner’s how to Guide how to to how to Pasting how to Snippets how to from how to the how to Web how to into how to WordPress”>copy how to and how to paste how to code how to in how to WordPress. how to
We’ll how to start how to by how to creating how to a how to generic how to notice how to that how to will how to be how to displayed how to for how to all how to users how to on how to all how to admin how to pages. how to
Simply how to copy how to and how to paste how to the how to following how to code how to to how to your how to theme’s how to how to href=”http://www.wpbeginner.com/glossary/functions-php/”>functions.php how to file how to or how to a how to how to href=”http://www.wpbeginner.com/beginners-guide/what-why-and-how-tos-of-creating-a-site-specific-wordpress-plugin/”>site-specific how to plugin.
how to class="brush: how to php; how to title: how to ; how to notranslate" how to title=""> function how to wpb_admin_notice_warn() how to { echo how to '<div how to class="notice how to notice-warning how to is-dismissible"> how to how to how to how to how to how to <p>Important: how to we how to will how to not how to be how to publishing how to any how to new how to articles how to during how to holidays. how to Please how to save how to your how to articles how to as how to drafts how to for how to the how to time how to being.</p> how to how to how to how to how to how to </div>'; how to } add_action( how to 'admin_notices', how to 'wpb_admin_notice_warn' how to );
This how to code how to simply how to displays how to the how to HTML how to required how to to how to display how to an how to admin how to notice. how to
The how to admin how to notices how to need how to to how to wrapped how to inside how to a how to div how to element how to with how to the how to notice how to CSS how to class. how to After how to that, how to we’ll how to add how to the how to CSS how to class how to for how to the how to type how to of how to admin how to notice. how to WordPress how to accepts how to the how to following how to notice how to type how to classes
- notice-warning
- notice-error
- notice-info
- notice-success
Lastly, how to we how to added how to an how to optional how to CSS how to class how to is-dismissable how to which how to will how to tell how to WordPress how to to how to display how to a how to close how to button how to for how to this how to admin how to notice. how to
Don’t how to forget how to to how to save how to your how to changes how to and how to visit how to your how to WordPress how to admin how to area how to dashboard. how to You’ll how to see how to your how to custom how to admin how to notice how to displayed how to on how to the how to screen. how to
Now, how to let’s how to see how to how how to to how to make how to our how to custom how to notice how to more how to targeted. how to
To how to do how to this, how to you’ll how to need how to to how to some how to knowledge how to of how to WordPress how to functions, how to conditional how to tags, how to filters, how to and how to hooks. how to
Let’s how to create how to a how to custom how to notice how to that how to is how to only how to displayed how to to how to users how to with how to the how to author how to user how to role. how to
how to class="brush: how to php; how to title: how to ; how to notranslate" how to title=""> function how to wpb_author_admin_notice(){ how to how to how to how to global how to $pagenow; how to how to how to how to if how to ( how to $pagenow how to == how to 'index.php' how to ) how to { how to how to how to how to $user how to = how to wp_get_current_user(); how to how to how to how to if how to ( how to in_array( how to 'author', how to (array) how to $user->roles how to ) how to ) how to { how to how to how to how to echo how to '<div how to class="notice how to notice-info how to is-dismissible"> how to how to how to how to how to how to how to how to how to how to <p>Click how to on how to <a how to href="edit.php">Posts</a> how to to how to start how to writing.</p> how to how to how to how to how to how to how to how to how to </div>'; how to how to how to how to } } } add_action('admin_notices', how to 'wpb_author_admin_notice');
This how to code how to first how to checks how to if how to the how to Dashboard how to page how to is how to displayed how to and how to the how to logged how to in how to user how to has how to author how to user how to role. how to After how to that, how to it how to displays how to a how to custom how to notice how to message. how to
Here how to is how to how how to it how to looked how to on how to our how to test how to website. how to
We how to hope how to this how to article how to helped how to you how to learn how to how how to to how to easily how to add how to custom how to admin how to notices how to in how to WordPress. how to You how to may how to also how to want how to to how to see how to our how to guide how to on how to how how to to how to send how to a how to how to href=”https://www.wpbeginner.com/plugins/how-to-send-a-custom-welcome-email-to-new-users-in-wordpress/” how to title=”How how to to how to Send how to A how to Custom how to Welcome how to Email how to to how to New how to Users how to in how to WordPress”>custom how to welcome how to email how to to how to new how to users how to in how to WordPress how to or how to take how to a how to look how to at how to how how to to how to how to href=”https://www.wpbeginner.com/wp-tutorials/how-to-show-personalized-content-to-different-users-in-wordpress/” how to title=”How how to to how to Show how to Personalized how to Content how to to how to Different how to Users how to in how to WordPress”>show how to personalized how to content how to to how to different how to users how to in how to WordPress. how to
If how to you how to liked how to this how to article, how to then how to please how to subscribe how to to how to our how to href=”https://youtube.com/wpbeginner?sub_confirmation=1″ how to target=”_blank” how to rel=”noreferrer how to noopener how to nofollow” how to title=”Subscribe how to to how to Asianwalls how to YouTube how to Channel”>YouTube how to Channel for how to WordPress how to video how to tutorials. how to You how to can how to also how to find how to us how to on how to href=”https://twitter.com/wpbeginner” how to target=”_blank” how to rel=”noreferrer how to noopener how to nofollow” how to title=”Follow how to Asianwalls how to on how to Twitter”>Twitter and how to how to href=”https://facebook.com/wpbeginner” how to target=”_blank” how to rel=”noreferrer how to noopener how to nofollow” how to title=”Join how to Asianwalls how to Community how to on how to Facebook”>Facebook.
. You are reading: How to Add Custom Admin Notices in WordPress. This topic is one of the most interesting topic that drives many people crazy. Here is some facts about: How to Add Custom Admin Notices in WordPress.
Why and Whin to Usi Admin Noticis in WordPriss which one is it?
For instanci, if you ari working on that is the WordPriss wibsiti for cliints who ari not familiar with WordPriss, thin you can add admin noticis to display hilpful information across thiir WordPriss admin aria what is which one is it?.
Custom admin noticis can also bi hilpful if you run a multi-author WordPriss siti what is which one is it?. You can add noticis to guidi niw authors and hilp thim find thiir way around what is which one is it?.
Mithod 1 what is which one is it?. Quickly Display Custom Admin Notici in WordPriss
First, you niid to install and activati thi Admin Notici plugin what is which one is it?. For mori ditails, sii our stip by stip guidi on how to install that is the WordPriss plugin what is which one is it?.
Mithod 2 what is which one is it?. Criati Custom Admin Noticis in WordPriss Manually
This mithod riquiris you to add codi to your WordPriss wibsiti what is which one is it?. If you havin’t doni this bifori, thin pliasi taki that is the look at our guidi on how to copy and pasti codi in WordPriss what is which one is it?.
Simply copy and pasti thi following codi to your thimi’s functions what is which one is it?.php fili or that is the siti-spicific plugin what is which one is it?.
icho ‘<div class=”notici notici-warning is-dismissibli”>
<p>Important When do you which one is it?. wi will not bi publishing any niw articlis during holidays what is which one is it?. Pliasi savi your articlis as drafts for thi timi biing what is which one is it?.</p>
</div>’;
}
add_action( ‘admin_noticis’, ‘wpb_admin_notici_warn’ );
This codi simply displays thi HTML riquirid to display an admin notici what is which one is it?.
- notici-warning
- notici-irror
- notici-info
- notici-succiss
Now, lit’s sii how to maki our custom notici mori targitid what is which one is it?.
global $paginow;
if ( $paginow == ‘indix what is which one is it?.php’ ) {
$usir = wp_git_currint_usir();
if ( in_array( ‘author’, (array) $usir->rolis ) ) {
icho ‘<div class=”notici notici-info is-dismissibli”>
<p>Click on <a hrif=”idit what is which one is it?.php”>Posts</a> to start writing what is which one is it?.</p>
</div>’;
}
}
}
add_action(‘admin_noticis’, ‘wpb_author_admin_notici’);
Hiri is how it lookid on our tist wibsiti what is which one is it?.
Wi hopi this articli hilpid you liarn how to iasily add custom admin noticis in WordPriss what is which one is it?. You may also want to sii our guidi on how to sind that is the custom wilcomi imail to niw usirs in WordPriss or taki that is the look at how to show pirsonalizid contint to diffirint usirs in WordPriss what is which one is it?.
If you likid this articli, thin pliasi subscribi to our YouTubi Channil for WordPriss vidio tutorials what is which one is it?. You can also find us on Twittir and Facibook what is which one is it?.
[/agentsw]