Archived topic
Header elements delaying whole site
39 replies · Started by John David on July 30, 2021
HI there,
I am using generatepress for a couple of sites and I have been very happy with its speed. I am located in Belgrade, Serbia.
But now, some time after an upgade of WP from 5.7.2 to 5.8, and GP premium from 1.10 to 2.03 (which had tested OK), an error occurred. Instead of an initial server response time of about 1 sec (GTMetrix test from Canada), which had been normal, the initial response time has jumped to 7.4 seconds for every page. I downgraded WP and GP – no change.
When I de-activated GP Elements, the response time returned to normal. So I activated Elements again, and one by one I set them all to draft. I was expecting to find one that had somehow gone rogue, but no: with each block of de-activation, the response time improved. When all were de-activated, the response was back to 1 second.
With Elements working, it appears that whatever single page I open, GP does something with all of the elements before it starts to download the page. With 117 pages, this takes time.The fewer elements (whether hooks or headers) on other pages that I am not opening, the faster the response time before download starts.
What is stranger, any action atb all in WP has the same response time. So with all elements active, when in the WP dashboard I open the list of pages, or the list of elements, or anything, there is a 7 second delay. With all the elements set to draft, these lists open instantly.
One strange item we found was a sub-folder in the wp-content/uploads folder called generatepress, containing only one file: style.min.css. That has never been there before.
It seems something is corrupted, which an upgrade does not address.
I have 117 pages in 2 languages, 58 different header images. I am reluctant to re-build the site from scratch, it will take months.
Have you ever come across a problem like this? Any ideas what to look for?
Thanks for any help you can give!
JD
Hi John,
Any chance you can link us to the site in question?
You can use the private information field.
https://docs.generatepress.com/article/using-the-premium-support-forum/#private-information
Let me know :)
Hi Ying, thanks for your reply.
The private info field doesn't seem to accept input. Never mind.
The site is https://halifax-transllation.com. Presently, the only active elements are headers on English and Serbian home pages, so it works fast. All other headers and hooks are set to draft.
Our host requires a fixed IP address from anyone to log in - security measure. If you can tell me your IP, I'll ask him to include it.
He says he tried re-installing both Gpress theme and plugin but the problem persisted. This puzzles me.
Sorry, spelled the site name wrong: halifax-translation.com
An update on our thinking:
We replaced Gpress theme, the problem persisted. We replaced Gpress premium plugin, the problem persisted. But running twentytwenty theme, no problem.
SOMETHING (and perhaps not something in Gpress) is doing something with every Gpress 'element' on the site before the server gives first response to any one page or other request, before ANYTHING you do in WP is displayed (like the list of pages). What can that something be?
If we replaced everything but the database, surely something in the database must be corrupt? Something that calls up Gpress elements (hooks and headers). When running twentytwenty, that something would not be activated, as twentytwenty does not use Gpress 'elements'. Am I right?
If the problem lies in the database, I suppose I have to re-make the site.
Hi there,
the GP Premium plugin only works with the GP Theme, so changing theme would disable the Header Elements.
Question:
How many header elements do you have?
And do those elements have a LOT of Display Locations rules ?
Hi David,
The site is pretty simple. Each page has one header element, so there are 117 header elements. There are 72 Serbian pages and 45 English ones. Corresponding pages share header images with different text (managed through Polylang plugin), so there are 72 different header images.
Each header element is set to display on one page only.
There are also 117 hooks with keywords statements (one per page) (I don't know if they are of any use so perhaps they just complicate things and can be discarded.), and 3 Google tags.
Really appreciate your help.
John David
Thats a lot of Hooks and Header Elements - which could be the main issue. We never expected them to be used to that extent.
Can i see a page with a Header Element that also includes the keywords statements - as ideally we would like to make these dynamic, so one Header Element and one Hook to output the necessary content.
Hi David,
I have re-activated the keywords hook on the English home page.
Previous test results from April show the site fully operational, with Pingdom (from Frankfurt) opening time for the home page of 885ms. The same time now, with all elements enabled is about 8.5 seconds. Now, with all elements DISabled, the speed is back to about 1 second.
The seven seconds difference is reduced proportionally with each element I disable, so each element is causing delay, by adding to the first server response time (as seen in GTMatrix waterfall).
The fact that enabling each and every element adds time to the 1st server response for any one page shows that the problem is equally associated with all elements. It is therefore unlikely to be an error in the element itself. The error must be in something that now calls all of them, when it ought to call only those relevant to the page being opened. Where can such a something be found?
After 3 weeks fruitless research and my company getting desperate, I am thinking I will make a new site, export all the pages from the current one, and import them to the new. Will the header elements export with them? Will that rogue 'something' export with them? (Remaking the pages and elements would take months!)
Thanks again,
David
I think the issue is more to do with the large number of Elements then it is to do with a 'problem' in the code they contain or a bug in the database.
Every time you create an Element, it injects code into the relevant hook. This code will contain a condition to check if the display rules match and if so get the relevant element 'post' type. Add to this the conditions that a translation plugin adds and you have a LOT of conditions to be parsed.
Ideally you want use as few Header Elements ( and Hooks ) to display the content dynamically.
Header Elements have dynamic content, such as the Featured Image background and Template tags for the Post Title and other Post Meta. Which can also include Custom Fields. Which is the best way to serve the content. Done correctly you could have just 1 or 2 header elements doing the same work that your 117 elements are doing.
Can you share the 'code' and a screenshot of one of your Header Elements so i can take a look?
David,
I can understand that. It's just that this site with all the same elements worked fine with the less-that-one-second load time, before the trouble started. It worked like that for months. I was testing it many times to try and get it as fast as possible, so I am quite sure
Also, I started with a different site, same content just in Serbian only, same name with .rs domain. That one is still there but not visible (it just re-directs to the bilingual .com site). But that one has all the same headings, on about 72 Serbian pages, and it still loads in one second.
The trouble actually began when I saw that the <h2> headings on the home page were left-justified in their columns and blue, instead of centred and red. What's more, when I re-saved the page, the first time I opened the page on another device it loaded fine, but the second time and thereafter the false formatting was back. This happened consistently. Very odd.
We searched around and found this style.min.css file in a gpress folder in the uploads folder. My colleague did something, I'm not sure what, and the font returned to normal, but then I noticed the aeon-long load time.
The funny thing is, with all the header elements active, it is not only page loading times that are slow. If I open the list of pages in WP, or the media gallery, or anything at all, it takes the same 7 seconds to open. And when the header elements are set to draft, WP works as fast as ever.
Can you please tell me how I can access the code of a header element? And how do I send you a file?
Thanks,
John David
If you can just edit one of the Header Elements and take a screen shot of the Page Hero tab, so i can see the content and the settings.
To share a link save the image in a cloud share or your media library and provide a URL to this file.
https://halifax-translation.com/wp-content/uploads/2021/08/Home-page-header-1-2021-08-02 15-44-56.png
https://halifax-translation.com/wp-content/uploads/2021/08/Home-page-header-2-021-08-02 15-46-10.png
https://halifax-translation.com/wp-content/uploads/2021/08/Home-page-header-3-2021-08-02 15-46-37.png
3 tabs in the header config.
This is the English home page, so it's set to display "Front page". Each other header is set to display on a specific page.
Thanks!
Ach.... I don't think you can see it, I'll have to find another way.