Skip Navigation

[Resolved] Too many queries per page load

This thread is resolved. Here is a description of the problem and solution.

Problem: When using Query Monitor, I can see that about 150 queries are being executed by Layouts to render the homepage.

Solution: Make delete the export folder at wp-content/themes/toolset-starter-child/theme-dd-layouts. Then check the query time for each of the queries associated with the Layouts plugin. If any query is consistently registering higher than .5ms, then further investigation is required. The total number of queries for this Layout does not seem abnormally high once the export folder is removed.

This support ticket is created 5 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

This topic contains 26 replies, has 2 voices.

Last updated by markD-13 4 years, 12 months ago.

Assigned support staff: Christian Cox.


I am running query monitor ( to try and optimise the website hidden link, which is running toolset starter theme with types, views and layouts.

I notice that on loading the home page the layouts plugin runs 130 queries??? Why is that?

I can send an excel spreadsheet of the queries if you need it.


That seems a bit high, although it's hard for me to tell without knowing how your Layouts are set up. Can you share screenshots showing the structure of any Layouts (including parents and children) used to build the homepage?
Can you set Query Monitor to compute its statistics while you're logged out? I'd like to know if the number of queries changes much depending on whether or not you're logged in as admin, where the front-end Layout editor comes into play.


Hi Christian,

Thanks for the quick reply. Running query monitor while logged out still shows 130 queries from layouts (capture2.png). The home page has 2 layouts: site is the parent and home is the child - see screenshots. The page content block inside the page itself is not using layouts, its blank.


Okay thanks. Still seems a bit high given the structure of your parent / child another quick troubleshooting test, could you temporarily disable all plugins except Toolset and Query Monitor, activate the Toolset Starter parent theme, then run your query by component again? If the number of queries by Layouts is significantly different, reactivate your child theme and other plugins one by one, testing with QM each time until the conflict is revealed.


Hi Christian, ok I've turned off all plugins except toolset and switched to the toolset starter theme (on my local dev).

Down to 42 queries, which is a great improvement but still high in my opinion. If i turn on the child theme it goes back up to 130.


Can you share a bit more information about what you have included in your child theme? Is there custom code in your functions.php file, or any other included PHP? If so, can you post a copy of your theme files somewhere and provide a download link for me to review them?


Hi Christian,

Plenty of custom code in functions.php. not sure how that can cause an increase in layouts queries though....

please see child theme files here: hidden link


Custom code that is invoked when rendering a Layout could increase the number of queries shown here. There are several Views and cells included, as well as any shortcodes in their content and filters applied, and I'm not really familiar with your codebase so I probably couldn't determine this quickly.

Can you create another simple Layout that includes a single Visual Editor cell, and some static text? Use the Layout icon at the top to set "no parent" for this Layout, then temporarily assign this new Layout to your homepage instead of the current Layout. I would like to compare the number of queries between a basic Layout and your custom hierarchical Layouts.

If it's significantly different, which I expect it will be, we could start adding rows and cells one by one to see if there is a single element causing a massive number of additional calls. We could then work to optimize that element if possible.


Hi Christian,

In my dev environment I have turned off all plugins except toolset and query monitor, created a new layout with 1 content field with dummy text in it, assigned it to the home page. I have also renamed any php files in my child theme, including functions.php so that they don't run.

Still runs 93 queries.


BTW the layout has no parent.


Okay I think the next step is for me to create a clone of your site so I can run some additional tests locally. I will use the Duplicator plugin to create that clone. If this is okay with you, please provide login credentials for your production site in the private reply fields here. I will create that clone and begin testing locally.


Edit - removed by admin

Screen Shot 2017-09-15 at 4.05.14 PM.png

Is there an IP restriction, or some other plugin restricting access to the admin area? I see this message on your login screen:

Sorry, your request cannot be accepted.

Sorry, please try again.


Works now, thanks. I'm working on creating a clone now, please stand by and I will update you soon.