Remove default widgets from WordPress dashboard
WordPress comes with some default widgets, i.e Activity, Quick Draft, WordPress News etc. Sometimes you may feel disgusted to see them on dashboard and wish to remove unnecessary widgets.
There are a lot of plugins that can help you clean you dashboard. And you can do the same with a little piece of code. To say truthfully, it’s safe to use a plugin instead of coding. But, a plugin will slow down your site. Try avoiding plugin as much as you can.
Follow the steps.
1) Copy the code below. (Double-click on code to select.)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<?php add_action('wp_dashboard_setup', 'my_custom_dashboard_widgets'); function my_custom_dashboard_widgets() { global $wp_meta_boxes; unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']); unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']); unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']); unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']); unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts']); } ?> |
2) Open your functions.php
file with an editor. functions.php file is located at your_site_directory/wp-content/theme/your_theme_name_here/functions.php
Alternatively, you can edit it from your WordPress admin panel. Go to Appearance>Edit.
Then select functions.php from the list at right side.
3) Paste the code at the end of the file. Be aware about PHP tag.
4) Save the file.
You’re done. Now go to your dashboard, no widgets are there 🙂
[Don’t do it if you are not well-known with PHP]