Just as widgets can be created to be displayed on the front end of the website, it’s just as easier (or even easier) to create widgets on the WordPress Dashboard. Dashboard widgets, just like regular site widgets, can be used for just about anything. So let’s make a really simple one.
First we write a quick function that will display the contents of our widget:
1 2 3 | function wpmods_dashboard_widget() { echo '<p><a href="http://wordpress.org/">WordPress</a> is a state-of-the-art publishing platform with a focus on aesthetics, web standards, and usability. WordPress is both free and priceless at the same time.</p>'; } |
It won’t show up just yet, so now we need to write a function that will actually create the widget:
1 2 3 | function wpmods_add_dashboard_widget() { wp_add_dashboard_widget( 'wpmods-custom-widget', 'About WordPress', 'wpmods_dashboard_widget' ); } |
The wp_add_dashboard_widget() function has three parameters: widget ID, widget title, and callback function. The widget ID can be anything. The title is entirely up to you, and the callback function is the first function we wrote that displays the content.
Now there’s just one more step to do before our widget will show up.
1 | add_action( 'wp_dashboard_setup', 'wpmods_add_dashboard_widget' ); |
This action will hook our first two functions into WordPress and cause our new widget to show up on the dashboard. If you did everything right, it should look like this:

Enjoy!






You see Pippin? Right there. This dude had the same problem as me! I wonder how many others out there struggle with the concept, but don't voice it. Hmmm, I see a gap for a tutorial or how-to; or a guide: "Wordpress' weird widgetry, and other quirky blog issues."
:-)
- spam
- offensive
- disagree
- off topic
Like