删除仪表板小部件是否会取消 WordPress 中的 SQL 查询?

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

我希望逐渐删除 WordPress 执行的许多我认为对速度没有必要的查询。

我在 smashing magazine 上阅读了这篇文章,"COMMENTS" 下提到的一件事是:

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

我知道有一种方法可以像这样从仪表板中删除元框:

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');

我的问题是:这样做是否会完全停止对数据库的查询?还是它仍然执行然后不显示它,仍在进行查询?如果可能的话,我真的不想更改核心文件。

执行此操作时不会调用执行实际工作的回调函数,所以是的,它确实会停止数据库查询。

cachegrind 与小部件

没有小部件的 cachegrind

仪表板小部件方法位于 wp-admin/includes/dashboard.php