This removes all the dashboard widgets from the WordPress dashboard in the wp-admin panel. I usually remove the “At a Glance” and “Quick Draft” widgets. I like to keep the “Activity” dashboard widget because it includes the Recent Comments. I also like to keep the WordPress Events and News widget, but I remove the Events and leave only the News. See below for how to do this.
Here is a breakdown of which dashboard widget each line in the following code removes.
Line 3 removes the “At a Glance” dashboard widget.
Line 4 removes the “Activity” dashboard widget which includes “Recent Comments.”
Line 5 removes the “Quick Draft” dashboard widget.
Line 6 removes the “WordPress Events and News” dashboard widget.
If you want to keep one of the widgets, then delete the line in the code for that widget.
// Remove WP admin dashboard widgets function isa_disable_dashboard_widgets() { remove_meta_box('dashboard_right_now', 'dashboard', 'normal');// Remove "At a Glance" remove_meta_box('dashboard_activity', 'dashboard', 'normal');// Remove "Activity" which includes "Recent Comments" remove_meta_box('dashboard_quick_press', 'dashboard', 'side');// Remove Quick Draft remove_meta_box('dashboard_primary', 'dashboard', 'core');// Remove WordPress Events and News } add_action('admin_menu', 'isa_disable_dashboard_widgets');
Modify the WordPress Events and News Widget
WordPress 4.8 has modified the WordPress News dashboard widget. It added Events, such as WordCamps and Meetups, to the WordPress News dashboard widget. Here are two ways to modify this new widget. The first example removes the Events section. This will make it look just like the old WordPress News widget, showing only News. The second example removes the WordPress News and leaves only the Events (WordCamps and Meetups).
- To remove the Events from the “WordPress Events and News” widget, add the following code to your functions. Line 4 removes the Events section. Line 6 removes the Meetups, WordCamps, and News links from the bottom of the widget. Line 8 changes the widget title from “WordPress Events and News” to “WordPress News.”
function remove_community_events_from_news_widget(){ echo '<script type="text/javascript">jQuery(document).ready(function($) { $("#community-events").remove(); // remove the community events from the WordPress Events and News Widget $(".community-events-footer").remove(); // Remove the Meetups, WordCamps, and News links from footer $("#dashboard_primary h2 span").text("WordPress News"); // Change the Widget title to WordPress News });</script>'; } add_action('admin_head','remove_community_events_from_news_widget');
- To remove only the News from the “WordPress Events and News” widget, add the following code to your functions. Line 4 removes the News section from the widget. Line 6 changes the widget title to just “WordPress Events.”
function remove_news_from_events_widget(){ echo '<script type="text/javascript">jQuery(document).ready(function($) { $(".wordpress-news").remove(); // remove the News section from the WordPress Events and News Widgets $("#dashboard_primary h2 span").text("WordPress Events"); // Change the widget title to just WordPress Events });</script>'; }
Sean
April 8th, 2017 at 4:05 pm
Where does wpjam_dashboard_widget come from? I don’t see it in any other WordPress site I’ve worked on and it wasn’t in my functions file to be added from the theme, any ideas?
Isabel
April 8th, 2017 at 8:51 pm
Sorry, that code was from 2011-2012. I just updated this page for the current WP dashboard widgets.
DAMIAN
September 25th, 2017 at 4:41 pm
Many thanks for the snippits Isabel. The removal of the new Events was just what I was looking for.
Robin Watson
April 26th, 2019 at 2:08 am
WP already facilitates hiding that (and other options) in Screen Options (drop down) at the top of the dashboard?
Damian
April 29th, 2019 at 11:23 am
True, but you can only opt for ‘news & events’ or no ‘news & events’. In my case I want to receive the news, but not to receive any notifications about the events.
Juha
March 27th, 2020 at 6:39 am
Does this still allow wordpress to load those events and news in the database?
I want to stop flooding my database and clean it. Any solution for that ?