Show message on wordpress admin dashboard

When you redirect the user to the admin dashboard pass on a GET variable named “success_notice”, for example. So you get a URL like this: /wp-admin/index.php?success_notice=1.

With that setup, just add the code that shows the success message on the dashboard only if that GET variable is set.

add_action('admin_notices', 'wpse75629_admin_notice');

function wpse75629_admin_notice()
{
    global $pagenow;

    // Only show this message on the admin dashboard and if asked for
    if ('index.php' === $pagenow && ! empty($_GET['success_notice']))
    {
        echo '<div class="updated"><p>Your success message!</p></div>';
    }
}

Leave a Comment