Speed Up Large WordPress & WooCommerce Website Back-End

Speed Up Large WordPress & WooCommerce Website Back-End

Last week while trying to find ways to improve KelbyOne’s Website speed, I came across a particular query being ran on the back-end that was responsible for slowing it down. Every time you tried loading an Order, Course, Lesson, Subscription or anything else, that query was responsible for almost 80% of the time it took to load.

The query was discovered using the latest version of Query Monitor. What did the query do, it goes through the whole postmeta table and tries to find every different meta_key found for a particular post_type. Needless to say if you have a large postmeta table with millions of records, this query will take a long time to run.

Results from the query populate the Custom Fields metabox select menu so that you can easily add new custom fields with a few clicks. Keep in mind that if you add this code to your Website, the select menu will not be populated anymore. Also, any custom fields added to the post will still show in Custom Fields metabox and you’ll have the “Add New Custom Field” interface to add any fields if you need to.

I was able to reduce page load times from around 27 seconds down to 4-5 seconds. How is this beneficial? Simple. The less time the server is busy running the query the more resources available to your visitors. Also, if you have a lot of people going in the back-end for things like Customer Service, they’ll thank you, too.

Enough rambling, here is the code.

Published by

Yojance Rabelo

To me, WordPress is a system to which versatility and power come naturally. Over the last thirteen years of my life, I have seen WordPress evolve from a simple blogging platform into the leading CMS that powers more than 27% of the Internet. My experience is broad, ranging all the way from writing WordPress plugins to creating WordPress themes based on PSD files. I am a master of developing and deploying membership sites powered by WooCommerce, WooCommerce Memberships, and WooCommerce Subscriptions.