This page may contain affiliate links. Please read my disclaimer for more information.

WordPress: How to Add Custom Dashboard Widget

Yesterday I created a new training video for one of my clients, a real estate agent who wanted a site specifically for listing investment properties. The video was to help them learn how to add the properties to their website. I didn’t want this video to be available to anyone, since it is a specific training for them. I decided to create a new dashboard widget area (sometimes called a dashboard meta box) in their WordPress Dashboard. Easy to access and always available when they need it.

Instead of installing another plugin, I decided to just hard code the new dashboard widget. Don’t worry, it’s simple and I’ve provided all the steps you need below.

Here is how the end result looks:

Custom WordPress Development

Lets get started

First thing we need to do is find and open the functions.php file, which is located within you theme folder.

Next step is to copy and past the code below into your functions.php file.


add_action('wp_dashboard_setup', 'custom_dashboard_widgets');
 
function custom_dashboard_widgets() {
global $wp_meta_boxes;

wp_add_dashboard_widget('custom_video_widget', 'Your Widget Title Here', 'custom_dashboard_video');
}

function custom_dashboard_video() {
echo 'Place your Video embed code or HTML here!';
}

That’s it! You all set, you new widget will show up in your dashboard and you can easily position it anywhere you want.

Credit goes to wpbeginner, that is where I first learned how to do this fancy stuff!

How are you going to use your new Dashboard Widget?

Leave a Comment

Join The Mantis Report

Get weekly WordPress news, resources, tutorials, and other tips from our experts.

Name*
This field is for validation purposes and should be left unchanged.

Skip to content