WordPress Admin Speed Optimization

We all know WordPress can get a little unruly, especially with sites that have been around for a decade and still use plugins that, while built with the best of intentions, do not scale well over time and number of users.

Example

One client, whose site matches all of the above, makes heavy use of Sensei and WooCommerce, and has for at least 10 years, with upwards of 100k registered students and thousands of orders. Both plugins gratuitously use the comments table to store course and lesson statuses and order status and notes. In fact, this particular site has over 760k rows in the comments table and nearly 890k rows in the commentmeta table!

Unfortunately, WordPress likes to tell you how many new comments there are and other pieces of comment related information, which is fine, but not when it has been inundated with information that is not relevant to comments on posts. Since we don’t easily get the benefits of Redis or other caching solutions in the admin side of things, a quick solution is to remove the comment meta box all together. This seemed to offer a nice little boost in performance, lessening the load on database.

Code

Removing the comment box is pretty easy and there are actually several solutions that can be used. I opted for using the ‘unset’ method and hooking into the ‘wp_dashboard_setup’ action.

<?php
/**
 * Disable the Recent Comments Widget from the WordPress Admin dashboard.
 */
function remove_dashboard_widgets() {
	global $wp_meta_boxes;
	unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments'] );
}
add_action( 'wp_dashboard_setup', 'remove_dashboard_widgets' );

Gist: