+2 votes
3.3k views
asked in Plugins by

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 by

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 by
Great stuff man! Many thanks for this.
0 votes
answered by
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 271 views
0 votes
1 answer 787 views
0 votes
0 answers 295 views
asked Dec 5, 2016 in Laravel by Jinu
+1 vote
1 answer 427 views
asked Oct 13, 2016 in Wordpress by Justin
0 votes
1 answer 327 views
+2 votes
1 answer 587 views
...