Top Nav

WordPress Admin Dashboard Slow Due To WordFence

Recently worked a WordPress site where the admin dashboard was taking a minute or more to load. Tracked the problem to the “Updates Needed” section in the “WordFence” block displayed on the dashboard. The Updates Needed section calls the WordPress  “wp_version_check()” function. This function, as part of building the data sent to with the update version check, calls the WordPress “count_users()” function. The “count_users()” function runs a query like this:

The number of “COUNT(NULLIF” columns depends on the number of user groups. For a site with a small number of users and groups this query is not a problem. But for a site with over 100K users this query took over 100 seconds to run.

To fix the problem, we used “wp-cli” to disable the “Updates Needed” section in WordFence:

Now the admin dashboard loads with no delay. This is a great example of the types of problems that come with scaling a WordPress site to large numbers of users.