My first site is almost done, but I am unhappy with how slow the filter-drop downs are populating. My site is for auto-parts so I have many categories with sub categories (Parts -> Type -> Make -> Model). All together I have 6236 categories/sub-categories, which yes I know is alot.

I have noticed that for every filter, whether the car make has 2 models or 30 models, the load times are always similar (8.5s-9s). After running Query Monitor, on every page I am getting the same query being called WP_Term_Query->get_terms() and it has 6236 rows, the exact same as the total of categories I have! Here are some screenshots of Query Monitor, one is for the "homepage" filter, the second is for the "post ad" filter.

Album: https://imgur.com/a/ICqyttz

I am only a beginner at WordPress and have built this site off the back of this theme I purchased. I have been able to solve most of the problems I have faceed by myself, but this one is way over my head. Others I have talked to have said that it is something to do with the transfer of data between the Database and SQL (does this sound right?). Another person with more knowledge looked into the back-end through Cpanel and found that, yes the database has indexes but the query was not using these indexes, rather calling all 6236 categories every single time. Once again I ask, does this sound like a realistic/common problem?

I use W3 Total Cache on the site, but when I turned-on Database Cache, I did not see any improvement.

For further information, I use this shared server on the "Premier" package, (300% CPU, 6GB RAM, 25GB SSD).

Has anyone had a similar problem before? As I said I am just a beginner, so maybe this is simple, maybe I have done something stupid eariler? But any help is appreciated greatly :)

If anyone wants me to provide more screenshots or info just ask, I am more then happy to provide!

You can find the site here. If you want to test the speed of the query for "posting an ad" you will need to create an account. This can be a throwaway one, I dont mind.

  • If you have to have 6236 categories, then you are doing something wrong. Why don't you use custom fields for different parts? Why categories? Also, from the screenshot it looks like your theme is populating all the categories from database, to use them in a shortcode function. From a quick look, seems like this part of the theme is creating the issue for you. – Fayaz Aug 21 '18 at 17:21
  • Thanks Fayaz for your reply. I hare 6200 categories for Make and models of cars. The hierarchy is what I wrote in the first paragraph. From Query Monitor I see the plug in is JS Composer which comes with Visual Composer (WP Bakery). From what you're saying, there is code in this shortcode (from WP Bakery) that is making populating all categories without indexes from the data base? – harrison Aug 21 '18 at 17:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.