Skip to content

Instantly share code, notes, and snippets.

@finalwebsites
Last active October 19, 2024 14:14
Show Gist options
  • Save finalwebsites/83d70fa7f4ba53b1377ac34d7e613ce1 to your computer and use it in GitHub Desktop.
Save finalwebsites/83d70fa7f4ba53b1377ac34d7e613ce1 to your computer and use it in GitHub Desktop.
WordPress: Disable dashboard widgets, like new & events or quick press
<?php
// add this code to the functions.php file from your chilc theme
add_action('wp_dashboard_setup', 'fws_remove_dashboard_widgets', 100);
function fws_remove_dashboard_widgets(){
remove_meta_box('dashboard_quick_press', 'dashboard', 'side'); // Quick draft
remove_meta_box('dashboard_primary', 'dashboard', 'side'); // WordPress Events and News
remove_meta_box('dashboard_activity', 'dashboard', 'side'); // Activity
remove_meta_box('dashboard_site_health', 'dashboard', 'side'); //Site Health Status
remove_meta_box('dashboard_right_now', 'dashboard', 'side'); // At a Glance
}
@finalwebsites
Copy link
Author

Inspect the code from your WP dashboard to find the hooks from other widgets (added by plugins or themes).
For example: remove_meta_box('e-dashboard-overview', 'dashboard', 'side'); for the Elementor widget.

Screenshot 2024-09-26 om 11 04 03

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment