search ]

Add Custom Admin Notices in WordPress

Display custom notices in the WordPress admin dashboard. Useful for warnings, reminders, or success messages for your team. For more on WordPress hooks.

add_action( 'admin_notices', function () {
    $screen = get_current_screen();

    if ( $screen->id !== 'edit-post' ) {
        return;
    }

    echo '<div class="notice notice-warning is-dismissible">';
    echo '<p>Remember to set a featured image before publishing.</p>';
    echo '</div>';
} );

Add to functions.php. Change the $screen->id check and message text to fit your needs. Use notice-success, notice-error, or notice-info for other styles.

Join the Discussion
0 Comments  ]

Leave a Comment

To add code, use the buttons below. For instance, click the PHP button to insert PHP code within the shortcode. If you notice any typos, please let us know!

Savvy WordPress Development official logo