DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
admin notices

How to Add Custom Notifications in WordPress

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

In WordPress, “notification” can mean a message shown inside the dashboard or an email sent to someone. For a classic wp-admin page, attach a callback to the admin_notices action; WordPress 6.4.0 and later also provide wp_admin_notice() for standard notice markup. Block Editor messages use the editor’s notices API, while email notifications use wp_mail().

Choose where the notification should appear

Destination WordPress approach Use it for
Classic wp-admin page admin_notices A notice displayed on an administrative screen.
Classic wp-admin page, WordPress 6.4.0 or later wp_admin_notice() Outputting a notice with core’s standard markup helper.
Block Editor Block Editor notices API A notice presented within the editor experience.
Email wp_mail() A message sent to a user or administrator rather than displayed on screen.

Before implementing one, decide what event or condition triggers it, who should see or receive it, what status it communicates, and whether a user’s dismissal should last beyond the current screen.

Add a classic admin notice with admin_notices

The admin_notices action lets a callback print a message on classic admin screens. WordPress documents the status classes notice-error, notice-warning, notice-success, and notice-info. This example scopes the output to the Plugins screen rather than showing it across the dashboard:

add_action( 'admin_notices', 'my_plugin_plugins_notice' );

function my_plugin_plugins_notice() {
    $screen = get_current_screen();

    if ( ! $screen || 'plugins' !== $screen->id ) {
        return;
    }

    echo '<div class="notice notice-info"><p>Your custom notification goes here.</p></div>';
}

Change notice-info to the status class that fits the message. Keep the condition aligned with the audience: a broad, unscoped callback can display the notice on many admin screens. See the WordPress admin_notices hook reference for the hook and notice markup guidance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Make a notice dismissible

Add is-dismissible to the notice classes to display a close icon:

echo '<div class="notice notice-success is-dismissible"><p>Settings saved.</p></div>';

This only dismisses the notice for the current screen. It does not permanently remember the user’s choice or guarantee that the message stays hidden after navigation or a reload. If dismissal must persist, the implementation needs its own persistence logic.

Use wp_admin_notice() on WordPress 6.4.0 or later

WordPress introduced wp_admin_notice() in version 6.4.0. It outputs a notice using a helper that accepts arguments for the message type, dismissibility, ID, extra classes, attributes, and paragraph wrapping. For example:

wp_admin_notice(
    'Your custom notification goes here.',
    array(
        'type'        => 'info',
        'dismissible' => true,
    )
);

Call it from an appropriate admin hook and condition, just as you would scope a notice callback. The helper is not available on versions earlier than 6.4.0; for those versions, use the documented admin_notices markup approach. Consult the wp_admin_notice() function reference for the supported arguments and behavior.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use the Block Editor notices API for editor messages

A message intended for the Block Editor should follow the editor’s notices API guidance rather than treating classic admin_notices HTML as interchangeable. WordPress notes that classic notices can render arbitrary HTML, while Block Editor notices use a more formal API. Follow the Block Editor Notices handbook for the editor-specific approach.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Send an email notification with wp_mail()

For a notification delivered by email, use wp_mail(); it sends email and is separate from displaying an admin notice. The wp_mail filter can modify the recipient, subject, message, headers, and attachments before sending. The WordPress wp_mail() function reference documents the function and its filter.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

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

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.