What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
WordPress notifications use different APIs depending on where the message should appear. Use the admin_notices action for a classic wp-admin screen, wp_admin_notice() for standard notice markup on WordPress 6.4.0 and later, the Block Editor notices API inside the editor, and wp_mail() when the notification must arrive by email.
Choose the notification route first
| Where the message appears | Use | Important limitation |
|---|---|---|
| Classic wp-admin page | admin_notices |
You print the notice HTML from a callback. |
| Classic admin page using core markup | wp_admin_notice() |
Available in WordPress 6.4.0 and later. |
| Block Editor | Block Editor notices API | Do not treat a classic HTML admin notice as the editor implementation. |
| Email to a user or administrator | wp_mail() |
This sends email; it does not create an on-screen admin notice. |
Add a custom notice to a classic admin page
The admin_notices action runs when WordPress renders classic administration screens. Attach a callback, check the current screen or condition that matters to your feature, and output a notice element with one of WordPress’s documented status classes: notice-error, notice-warning, notice-success, or notice-info. See the official admin_notices reference.
<?php
add_action( 'admin_notices', 'my_plugin_admin_notice' );
function my_plugin_admin_notice() {
$screen = get_current_screen();
// Limit this example to the Posts list screen.
if ( ! $screen || 'edit-post' !== $screen->id ) {
return;
}
echo '<div class="notice notice-info"><p>Your custom message goes here.</p></div>';
}
Put the code in a plugin or in the code location you use for site-specific functionality. Replace the screen check and message with the event your feature needs. If a value is dynamic, escape it for its output context instead of concatenating untrusted input into the markup.
Make the notice dismissible for the current screen
Add the is-dismissible class to the notice element:
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware match#1 Best Overall
echo '<div class="notice notice-success is-dismissible"><p>Settings saved.</p></div>';
This adds a close icon, but the dismissal is only for the current screen. It does not permanently suppress the message and does not guarantee that it stays hidden after navigation or a reload. Persisted dismissal requires your own storage and condition.
Use wp_admin_notice() on WordPress 6.4.0 or later
WordPress 6.4.0 introduced wp_admin_notice(), a core helper that outputs standard admin-notice markup. Its arguments let you set the notice type, whether it is dismissible, an ID, additional classes, HTML attributes, and whether the message is wrapped in a paragraph. Consult the function reference for the current parameter details.
Rank #2
<?php
if ( function_exists( 'wp_admin_notice' ) ) {
wp_admin_notice(
'Your settings were saved.',
array(
'type' => 'success',
'dismissible' => true,
'id' => 'my-plugin-settings-saved',
'additional_classes' => array( 'my-plugin-notice' ),
'paragraph_wrap' => true,
)
);
}
The version check keeps the code from calling a function that is unavailable on older WordPress installations. Use the helper when you want WordPress to generate the notice structure; use the action callback when you need to decide where and when a classic-screen message is printed.
Display a notification inside the Block Editor
Block Editor screens use the editor’s notices API rather than assuming that a PHP callback printing classic admin HTML is the equivalent solution. Follow the Block Editor Notices handbook for the JavaScript-based pattern, including how your editor code creates and displays notices. The handbook also distinguishes the editor approach from classic notices; in the classic editor, callbacks on admin_notices can render HTML, while Block Editor notices follow the formal editor API.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Send the notification by email with wp_mail()
When the recipient should receive an email instead of seeing a message in wp-admin, call wp_mail(). It is a separate delivery path from both classic admin notices and Block Editor notices.
<?php
$sent = wp_mail(
'admin@example.com',
'WordPress task completed',
'The scheduled task finished successfully.'
);
if ( ! $sent ) {
// Record or handle the failed send according to your plugin's needs.
}
The wp_mail() reference documents the recipient, subject, message, headers, and attachments parameters. WordPress also provides the wp_mail filter, which can change those values before sending. A return value of true indicates that the send process accepted the request; it is not a guarantee that the recipient’s mailbox ultimately delivered the message.
Rank #4
Design the trigger and audience deliberately
- Trigger: tie the callback or mail call to the event or condition that actually needs attention, rather than printing on every admin request.
- Audience: limit an admin notice to the relevant screen and user context; choose the intended recipient explicitly for email.
- Status: use
error,warning,success, orinfoto communicate the state accurately. - Dismissal: treat
is-dismissibleas a current-screen close control. Store a separate preference only if the message must remain dismissed. - Surface: keep classic admin rendering, Block Editor notices, and email as separate implementations; they are not interchangeable output channels.
Troubleshoot a missing custom notification
The classic notice never appears
- Confirm the callback is attached to
admin_notices. - Check that your screen or condition test is not returning early.
- Verify that the code is running in an administrative request where the hook is rendered.
The close button does not persist
That behavior is expected: is-dismissible only handles dismissal for the current screen. Implement persistence yourself if the product requirement is a lasting dismissal.
The code runs in the Block Editor but no editor notice appears
Use the Block Editor notices API documented by WordPress instead of relying on classic PHP notice markup.
Best Value
Email is not received
Separate the on-screen notice code from the wp_mail() call, check the function’s return value, and inspect the mail configuration and delivery path used by the site. The WordPress function reference explains the available message, header, and attachment arguments.
Quick Recap
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.

