Skip Navigation

[Resolved] Site slow and times out with only toolset blocks and types activated

This support ticket is created 2 years, 10 months 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 13 replies, has 3 voices.

Last updated by Rickard 2 years, 10 months ago.

Assisted by: Waqar.

Author
Posts
#2404239

I am trying to:

Yesterday the site got slow when trying to save articles and this morning site timing out on all pages with a view shortcode

#2404251

Tested some more.. The problem seem to be in toolset blocks. When it is activated i can not even same the themes function.php (tried it since it should not be affected by gutenberg)

#2404285

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Rickard

Do you notice and PHP warnings or errors in your debug.log?

If you haven't already, turn on the debug log by editing your wp-config.php file and change the line with WP_DEBUG like so:

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
define('WP_DISABLE_FATAL_ERROR_HANDLER',true);

That will create a debug.log file in your /wp-content/ directory which you can examine in any text editor. Try performing the same actions where you are having problems.

And in the browser console, does that report any problems, in particular with the network requests?

It's possible we may need access to your site to be able to investigate, so let me set up a private reply to get credentials from you. You may want to create a temporary admin user for us to use that you can later delete. And be sure to have a current backup of your site.

#2404475

I have remade the home page with kadence post block instead of toolset view shortcode so there is a little less stress.

Had to deactivate toolset blocks to be able to edit the page.

Most pages with a view shortcode is now slow and takes a long time to open to edit and save. Child themes function.php cant be saved.

This is an error that keeps popping up now and then:
[24-Jun-2022 15:08:09 UTC] PHP Warning: Attempt to read property "ID" on null in sitepath/public_html/wp-content/plugins/toolset-blocks/vendor/toolset/toolset-theme-settings/

#2405737

Thank you for sharing the update and the admin access details.

I'm not able to log in to the admin area, as it keeps showing the incorrect username message.

Can you please check and share the temporary admin login details again? I'll also need your permission to download a clone/snapshot of the website, in case it needs to be investigated on a different server.

Note: Your next reply will be private and it is recommended to make a complete backup copy, before sharing the access details.

#2407031

Thank you for sharing the admin access.

I tried to view the preview of the old homepage, but it keeps showing the HTTP Error 500.

Do you see any errors or warnings in the server's error log and do I have your permission to download a clone/snapshot of the website? This will help in investigating this on a different server.

#2407077

Yes you can make a copy.

The error log is in the debug.log inside wp-content folder.

There are some errors popping up like:

[28-Jun-2022 05:44:59 UTC] PHP Warning: Attempt to read property "ID" on null in ..public_html/wp-content/plugins/toolset-blocks/vendor/toolset/toolset-theme-settings/compatibility-loader/toolset-theme-integration-settings-helper.php on line 426
[
28-Jun-2022 10:07:47 UTC] PHP Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 1605632 bytes) in ../public_html/wp-content/plugins/kadence-blocks/dist/init.php on line 676

#2407597

Thank you for the permission and I've downloaded a duplicator package from your website.

I'll be running some tests and will share the findings, as soon as this testing completes.

Thank you for your patience.

#2408359

Just wanted to update you that I'm still working on this and will share my findings in the next few hours.

#2409003

Thank you for waiting, while I tested your website's clone on a couple of different server environments.

On the old home page, I see there are 5 different views used through the shortcodes. The main error that is shown when the preview of the old home page fails is related to the exhaustion of the allowed memory.

Here are some recommendations, which fixed this error on your website's clone and should work on your live website too:

1. I increased the allowed memory size from "768M" to "1024M".

In your website's 'wp-config.php' file, you'll find this line, which can be used to increase it:


define( 'WP_MEMORY_LIMIT', '768M' );

If changing this line doesn't work to increase the allowed PHP memory limit on the server, you may have to consult your hosting support to do this for you.

2. In the loop of all the views used on the home page, you'll find the "wpv-post-body" shortcode, that loads the same content template:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-body

You can include the suppress_filters="true" attribute to this shortcode so that non-essential content filters are not applied.

Example:


[wpv-post-body view_template="post-list-card-template" suppress_filters="true"]

3. To improve the performance of the view's query, you can uncheck the option "Don't include current page in query result", from the views used on the homepage.
( example screenshot: hidden link )

I hope these recommendations will work and let me know how it goes.

#2410997

Im still testing but what i have found this far is that the problem seems to be with the guides-with-tag view

I tested with just puting one view shortcode on a page and nothing else.

[wpv-view name="guides-with-tag" wpvposttag="Marketing"]

The test page can hardly load and gets 500 on and off. Editing takes extremly long time to load as well.

Most other views i tried seems to run fine.

I will continue to run some tests.

#2411039

What i have found is that the problem is connected to the posts in the guides post type.

'The problem seem to come from the posts that contain the shortcode like [wpv-view name="guides-with-tag" wpvposttag="Marketing"]

For every post that contain the same shortcode, execution of the view goes exponentialy slower.

If I put all of the post containing the shortcode in draft the view runs as normal.

If I publish one - the execution time doubles.

With two or three posts with the shortcode published the execution time is over a minute and sometimes it responds with 500.

For some reason it seem the view wants to run the shortcode that is on the page even if it is not displayed and it for some reason becomes some insane inception / recusrion.

#2411511

Thank you for sharing your findings.

Since the view's shortcodes are added to the body/content of the "Guides" and the "Lists" posts, when their excerpt is called in the views used on the old homepage, it results in a recurring loop.

To avoid, this you can register a custom shortcode that can get the raw excerpt from the body/content of the posts, excluding any HTML or shortcodes.
( ref: https://developer.wordpress.org/reference/functions/the_excerpt/ )

For example:


function custom_excerpt_length( $length ) {
    // set excerpt length to 17 words
    return 17;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );


add_shortcode('custom-show-excerpt', 'custom_show_excerpt_fn');
function custom_show_excerpt_fn() {
    ob_start();
    echo the_excerpt();     
    return ob_get_clean();
}

The first code snippet sets the default excerpt length to '17' words and the second one registers a custom shortcode 'custom-show-excerpt' for getting the raw excerpt.

The above code snippets can be included through either Toolset's custom code feature ( ref: https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/ ) or through the active theme's "functions.php" file.

Next, in your content template 'post list card template' (which is being used by all those old home page views), you can replace:


[wpv-post-excerpt length="17" count="word" format="noautop"]

With this new excerpt shortcode:


[custom-show-excerpt]

I hope this helps and let me know how it goes.

#2411851

Great, thanks for the help!

Ill do some more testing and open another ticket later on if I cant get it working.