I am running query monitor (https://wordpress.org/plugins/query-monitor/) to try and optimise the website lien caché, 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 layouts...as 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: lien caché
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.
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.
Works now, thanks. I'm working on creating a clone now, please stand by and I will update you soon.