+2 votes
5.5k views
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
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
by
Great stuff man! Many thanks for this.
0 votes
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 3.0k views
0 votes
1 answer 4.1k views
0 votes
0 answers 1.0k views
+1 vote
1 answer 3.7k views
0 votes
1 answer 2.3k views
0 votes
0 answers 994 views
asked Dec 6, 2016 in Laravel by Jinu
...