Does removing the dashboard widgets cancel the SQL queries in WordPress?

I’m looking to gradually remove as many queries that WordPress does that I don’t find necessary for speed.

I read this article on smashing magazine and one thing mentioned under “COMMENTS” was:

Read More

For instance, I killed the ‘Right Now’ and ‘Recent Comments’ sections
of the Dashboard.”

I know there’s a way to remove meta boxes from the dashboard like so:

function remove_dashboard_widgets(){
remove_meta_box('dashboard_right_now', 'dashboard', 'normal'); // Right Now
remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal'); // Recent Comments
remove_meta_box('dashboard_incoming_links', 'dashboard', 'normal'); // Incoming Links
remove_meta_box('dashboard_plugins', 'dashboard', 'normal'); // Plugins
remove_meta_box('dashboard_quick_press', 'dashboard', 'side'); // Quick Press
remove_meta_box('dashboard_recent_drafts', 'dashboard', 'side'); // Recent Drafts
remove_meta_box('dashboard_primary', 'dashboard', 'side'); // WordPress blog
remove_meta_box('dashboard_secondary', 'dashboard', 'side'); // Other WordPress News
// use 'dashboard-network' as the second parameter to remove widgets from a network dashboard.
}
add_action('wp_dashboard_setup', 'remove_dashboard_widgets');

My question is: by doing this, will this stop the query to the database completely? Or does it still do it THEN not show it, still taking up a query? I really don’t want to change the core files if possible.

Related posts

1 comment

  1. the callback functions that do the actual work never gets called when you do this, so yes, it does stop the database queries.

    cachegrind with widgets
    enter image description here

    cachegrind without widgets
    enter image description here

    dashboard widget methods are located in wp-admin/includes/dashboard.php

Comments are closed.