Ever forgotten to take care of something on your website? Let’s be honest—who hasn’t? One way to ensure nothing slips through the cracks is by setting up custom admin notices in WordPress. Think of it as a sticky note that lives in your WordPress dashboard.
WordPress core, themes, and plugins often display admin notices to alert users of errors, warnings, or updates. As a site admin, you can create your own custom notices to keep your team in the loop on important updates or reminders.
These notices act as handy alerts for anyone logged into the admin area. In this guide, we’ll walk you through the steps to add custom admin notices in WordPress.
Contents
ToggleWhy Custom Admin Notices Can Be a Game-Changer for Your Website
Custom WordPress admin notices are an excellent way to keep your team or clients informed and on track, especially if they’re not WordPress pros. Think of them as gentle reminders or helpful tips within the dashboard.
Let’s say you’re working on a site for a client who’s new to WordPress. You could add admin notices to provide quick instructions, guiding them on tasks they might need help with. Here are a few other ways to make the most of custom admin notices:
- Inform your team about maintenance updates: Let everyone know when the site will be in maintenance mode.
- Guide writers and editors: On multi-author sites, provide editorial workflow tips to help them navigate the dashboard.
- Remind users of best practices: For example, share a list of do’s and don’ts for managing tasks, content, or media.
Overall, custom admin notices are a useful tool for sharing messages with your team or clients. Just remember to keep it balanced—too many notifications can be distracting or even annoying, so only use them for what’s essential.
Also read: How to Provide Temporary Admin Access to Your WordPress Site
How to Add Custom Admin Notices in WordPress?
Now, let’s dive into how you can add custom admin notices in WordPress! We’ll walk you through two different methods. Use the quick links below to jump to the one that suits you best:
- Method 1: Add Custom WordPress Admin Notices Using a Plugin
- Method 2: Add Custom WordPress Admin Notices with Code
Adding Custom Admin Notices with the WP Custom Admin Interface Plugin
With the WP Custom Admin Interface plugin, you can easily customize your WordPress dashboard, including adding custom admin notices.
Step 1: Install and Activate the Plugin: First, install and activate the WP Custom Admin Interface plugin. If you’re unsure how to install WordPress plugins, check out our guide.
Step 2: Access Admin Notice Settings: Head to Custom Admin Interface > Admin Notice. The settings page looks a lot like the Classic Editor, making it easy to work with.
Step 3: Add Your Message: Scroll down to enter your custom notice message. You can use plain text or shortcodes from the options above the editor. For example, the shortcode [WEBSITE_URL] will dynamically display your site’s domain.
Feel free to add images or style the text using the toolbar to make your notice stand out.
Step 4: Choose Notice Color: Select a color to match the type of notice:
- Green for success
- Blue for important info
- Yellow for warnings
- Red for errors
Step 5: Set Expiration and Dismissal Options: You can add an expiration date for the notice or leave it blank to keep it up indefinitely. For success or info messages (green or blue), consider making the notice dismissable. For warnings or errors, you may want it to remain visible until resolved.
Step 6: Select Visibility: Decide who can see the notice. You can make it visible to everyone or limit it to certain user roles by clicking the + button.
Step 7: Save Your Notice: Once you’re satisfied, click Save All Settings.
Read: How to White-Label WordPress Admin Dashboard
Add Custom WordPress Admin Notices with Code
If you’re only interested in creating custom admin notices without the extra features of a plugin, coding is a great option. This method allows you to add multiple notices and customize them as needed across different pages.
If adding code to WordPress sounds daunting, don’t worry! We’ll show you an easy and safe way to do it using WPCode—a beginner-friendly plugin for managing code snippets without directly editing your site’s core files.
Setting Up WPCode
- Install and Activate WPCode: Start by installing WPCode. For help with this, refer to our guide on installing WordPress plugins.
- Create Your Custom Code Snippet: Go to Code Snippets > + Add snippet and click Use Snippet under “Add Your Custom Code.” Give your snippet a title, like Custom Admin Notice, and set the Code Type to PHP Snippet.
Add Your Custom Notice Code: Copy and paste the following code into the Code Preview box:
function wpb_admin_notice() {echo ‘<div class=”notice notice-warning is-dismissible”><p>Important! We will not be publishing any new articles during the holidays. Please save your articles as drafts for the time being.</p></div>’; }add_action( ‘admin_notices’, ‘wpb_admin_notice’ ); |
- This code defines a function that displays a yellow warning box in the admin area. You can replace the text in <p></p> with your message. To change the box color, replace notice-warning with notice-error (red), notice-info (blue), or notice-success (green).
- Choose Insertion Settings: Scroll to the Insertion section, set the method to Auto Insert, and the location to Admin Only to ensure the notice only appears in the admin area.
- Activate and Save: Set the snippet to Active and click Save Snippet.
- Now, check your dashboard to see the new admin notice at the top!
Also know: How to Seamlessly Edit and Customize Headers in WordPress?
Displaying Notices for Specific User Roles
Want to limit a notice to specific roles, like editors? Use the following code to create a custom admin notice for specific users:
function wpb_admin_notice_editor() {global $pagenow;$admin_pages = [ ‘index.php’ ];$user = wp_get_current_user();if ( in_array( $pagenow, $admin_pages ) && in_array( ‘editor’, (array) $user->roles ) ) {echo ‘<div class=”notice notice-warning is-dismissible”><p>Reminder! Don’t save published posts as drafts after updates. Just click “Update.” Thanks!</p></div>’;}}add_action( ‘admin_notices’, ‘wpb_admin_notice_editor’ ); |
This code restricts the notice to users with the editor role on the dashboard. To add more admin pages, update $admin_pages = [ ‘index.php,’ ‘plugins.php,’ ‘edit.php’ ]; with other page slugs.
And that’s it! You now have a flexible, custom admin notice setup tailored exactly to your needs.
Related: How to Setup Elementor Shortcodes for Easy Template Use
Best Practices for Custom Admin Notices
Creating effective custom admin notices is all about balancing helpful communication with a smooth user experience. Here are some best practices to keep in mind:
- Be Clear and Concise: Keep messages short, straightforward, and clear. Avoid extra words or vague language that might confuse users—get straight to the point.
- Show Relevant and Timely Info: Only display notices that are necessary or time-sensitive. Irrelevant or outdated notices can clutter the dashboard and overwhelm users.
- Avoid Overuse: Keep your admin dashboard clean by limiting the number of active notices. Too many at once can be distracting, so stick to what’s essential.
- Maintain Consistent Branding: Style your notices to match your site’s branding—use the same colors, fonts, and design elements. This makes your notices feel cohesive and professional.
- Consider Accessibility: Ensure all users can access your notices, including those with disabilities. Use high-contrast colors, readable fonts, and alternative text for images to help visually impaired users.
- Test Across Devices and Browsers: Check that your notices display correctly on different browsers, screen sizes, and devices. Make sure they’re easy to dismiss and responsive.
- Provide User Control: Make notices dismissible when possible. Users should be able to hide a notice if it’s no longer relevant, keeping their dashboard uncluttered.
- Think About Localization: If you have a global audience, consider making notices translatable. This ensures users from different regions can understand the information in their language.
- Keep Security in Mind: Follow the best security checklist to protect against vulnerabilities. Sanitize and validate any user input to prevent issues like cross-site scripting (XSS).
- Offer Guidance When Needed: Include tooltips or brief instructions to help users understand what each notice is for and any actions they should take.
Learn: Tips to Speed Up WP-Admin in WordPress
Wrapping Up
Notifications can be a super handy way to share specific information with the right people. Maybe it’s an error alert for the team member who manages your site’s code or a reminder for a subscriber that new content or a product is ready for them.
These notifications can be just as helpful as other WordPress tools, like a floating footer bar or a custom widget that highlights key info. Whatever method you choose, make sure it’s effective and doesn’t overwhelm your users.
While it might be okay to send multiple notifications to employees, visitors are a different story—they’re here to enjoy your site, not to sift through a barrage of alerts.
The key is finding a balance between useful and annoying. Keep it impactful, not intrusive!