How to Add a Widget in the WordPress Admin Dashboard

How to Add a Widget in the WordPress Admin Dashboard

Last modified: April 11, 2022

FAQ
Cloudways

While the WordPress admin is a highly versatile tool and can be a very important part of your management. There are still improvements that can be made. Some plugins can help you see metrics. You can also see some stats when you use hosts like Cloudways. But not all of them are fit for purpose. Therefore, you might want to learn how to add a widget to the WordPress admin dashboard yourself.

In this article, we teach you to do that and have a better set of controls and metrics on your website.

Show More

* This button will show the rest of the post and open up an offer from a vendor

The Basic Dashboard Widget

The basic dashboard widget is very simple. All you need to do is use the wp_add_dashboard_widget() function within the code to get it to register on your WordPress admin.

Then you can create a function to display content. For example, here is some template code that can be used to create something quickly.

add_action( 'wp_dashboard_setup', 'register_my_dashboard_widget' );
function register_my_dashboard_widget() {
wp_add_dashboard_widget(
'my_dashboard_widget',
'My Dashboard Widget',
'my_dashboard_widget_display'
);
}
function my_dashboard_widget_display() {
echo 'Display Widget Example One';
}

This code should be placed somewhere in a plugin. However, testing it quick can be done within the functions.php file, but it would need to be taken out long term.

The Problems with Coding

Now there are some problems with this. The first is that a simple error on your part could render your website or the plugin corrupt. This can cause you to have to rebuild your website.

Another problem is that without the best code, you could slow down your website. Therefore, you need to have some experience when it comes to building your widgets to ensure that you get the most out of them.

If you do make a mistake, then there might be a chance to reverse the problem. The first thing that you would need to do is to disable the plugin where the code was entered. You can do this by entering your website’s FTP files and changing the plugin’s name to [plugin]_old and then deleting the file from the website. You can then re-install a clean file to the FTP.

If this hasn’t worked, you can disable all the plugins from the website, by going into the FTP and changing the plugin’s file name to plugins_old. Then you can rename the folder and reactive them within the dashboard.

The final option is to reload a backup of your website. Your website host might have a previous backup.

An Alternative Option

Another option for you to add a widget to your WordPress website is to use a plugin. There is a plugin, WordPress Dashboard Suite, that can help you add more information to your WordPress dashboard and help you manage your website better.

This is a free plugin and is highly rated.

Final Word: How to Add a Widget in the WordPress Admin Dashboard

Above are two simple ways how to add a widget in the WordPress admin dashboard for you to try. Both are free to try, but always ensure that you have the best WordPress hosting to prevent a slow down of your website.

Recap:
Save 4 Later
Email liked links to yourself