+2 votes
4.9k 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 2.8k views
0 votes
1 answer 3.7k views
0 votes
0 answers 831 views
+1 vote
1 answer 3.4k views
0 votes
1 answer 2.0k views
0 votes
0 answers 838 views
asked Dec 6, 2016 in Laravel by Jinu
...