Showing notification on WordPress admin dashboard home

+2 votes
2766 views
asked May 20, 2016 in Plugins by anonymous

As part of my plugin, I would like to show a notification on WordPress admin panel dashboard home. Like this :

Which hook to use ? Please advice.

2 Answers

+1 vote
answered Jun 1, 2016 by Mike

These are called dashboard widgets. codex have documentation on this. Here is an example :

/**
 * Add a widget to the dashboard.
 *
 * This function is hooked into the 'wp_dashboard_setup' action below.
 */
function example_add_dashboard_widgets() {

	wp_add_dashboard_widget(
                 'example_dashboard_widget',         // Widget slug.
                 'Example Dashboard Widget',         // Title.
                 'example_dashboard_widget_function' // Display function.
        );	
}
add_action( 'wp_dashboard_setup', 'example_add_dashboard_widgets' );

/**
 * Create the function to output the contents of our Dashboard Widget.
 */
function example_dashboard_widget_function() {

	// Display whatever it is you want to show.
	echo "Hello World, I'm a great Dashboard Widget";
}

For more check out : https://codex.wordpress.org/Dashboard_Widgets_API
commented Jun 29, 2016 by Jacob John
Great stuff man! Many thanks for this.
0 votes
answered Jul 14, 2016 by Clive Lewis
This is sooo Cool !

I had an attempted failed search for this feature build long before.

This is not an answer, but I coudnt resist to leave my comment for this question. Moderators please excuse me or please move this to appropriate section ;)

Related questions

0 votes
0 answers 178 views
0 votes
1 answer 178 views
0 votes
0 answers 84 views
asked Dec 6, 2016 in Laravel by Jinu
+1 vote
1 answer 183 views
asked Oct 14, 2016 in Wordpress by Justin
0 votes
1 answer 168 views
+2 votes
1 answer 294 views
...