Skip Navigation

[Resolved] Templates fail to open after upgrade

This support ticket is created 2 years, 8 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 17 replies, has 2 voices.

Last updated by Arno 2 years, 8 months ago.

Assisted by: Waqar.

Author
Posts
#2374159
Template edit error.jpg

Hi,

I've upgraded to WordPress 6.0, PHP 8.0 and the latest Toolset plugins. Since then, some of my templates fail to open properly, so I can't edit them.

1) One does open but it does not load all views. Some remain grey, loading forever.

2) Another throws an error immediately upon opening (see attached).

3) Others open without any issue.

Is this a common issue for the latest version? What can I do to continue my work?

Note: I'm currently on a relatively large shared hosting plan (4 Gb RAM). This might be tight so I am planning to upgrade to an 8 Gb RAM VPS soon. Whether that will help solve this I don't know. Issue 2 also happens when there are plenty of free resources.

#2374319

Hi,

Thank you for contacting us and I'd be happy to assist.

We haven't received any recent report related to content template editing, so it could be something specific to your website or template's content.

Have you checked the server's error log for any specific errors or warnings?
( ref: https://wordpress.org/support/article/debugging-in-wordpress/ )

regards,
Waqar

#2374411

Hi Waqar,

I enabled error logging and opened both templates. Then I found this in the log:

[31-May-2022 09:52:57 UTC] PHP Warning: Attempt to read property "dynamic_sources_content_processed" on null in /home/website/website_com/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/Sources/PostContent.php on line 62
[31-May-2022 09:52:57 UTC] PHP Fatal error: Uncaught Error: Attempt to assign property "dynamic_sources_content_processed" on null in /home/website/website_com/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/Sources/PostContent.php:67
Stack trace:
#0 /home/website/website_com/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/DynamicSources.php(514): Toolset\DynamicSources\Sources\PostContent->get_content(NULL, NULL)
#1 /home/website/website_com/wp-includes/class-wp-hook.php(307): Toolset\DynamicSources\DynamicSources->get_source_content('', '__current_post', 1881, Object(Toolset\DynamicSources\Sources\PostContent))
#2 /home/website/website_com/wp-includes/plugin.php(191): WP_Hook->apply_filters('', Array)
#3 /home/website/website_com/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/Cache.php(92): apply_filters('toolset/dynamic...', '', '__current_post', '1881', 'post-content')
#4 [internal function]: Toolset\DynamicSources\Cache->get_data_for_sources(Array, '__current_post', '1881')
#5 /home/website/website_com/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/Cache.php(49): call_user_func_array(Array, Array)
#6 /home/website/website_com/wp-includes/class-wp-hook.php(307): Toolset\DynamicSources\Cache->add_cached_data(Array, '1881')
#7 /home/website/website_com/wp-includes/plugin.php(191): WP_Hook->apply_filters(Array, Array)
#8 /home/website/website_com/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/DynamicSources.php(967): apply_filters('toolset/dynamic...', Array, 1892)
#9 /home/website/website_com/wp-includes/class-wp-hook.php(307): Toolset\DynamicSources\DynamicSources->get_dynamic_sources_data(Array)
#10 /home/website/website_com/wp-includes/plugin.php(191): WP_Hook->apply_filters(Array, Array)
#11 /home/website/website_com/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/DynamicSources.php(942): apply_filters('toolset/dynamic...', Array)
#12 /home/website/website_com/wp-includes/class-wp-hook.php(307): Toolset\DynamicSources\DynamicSources->register_localization_data('')
#13 /home/website/website_com/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
#14 /home/website/website_com/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
#15 /home/website/website_com/wp-admin/edit-form-blocks.php(270): do_action('enqueue_block_e...')
#16 /home/website/website_com/wp-admin/post.php(187): require('/home/website/...')
#17 {main}
thrown in /home/website/website_com/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/Sources/PostContent.php on line 67

I can give you the full log if I can share it privately here. Also I can give you access to a test site if needed.

Thanks,
Arno

#2374473

Thanks for writing back.

I'm setting your next reply as private, so that you can share the temporary admin login details, along with the names of the content templates which are not editable.

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

#2375053

Thank you for sharing the admin access.

To examine the content of the problematic views and content template, I'll need access to the website's database.

Do I have your permission to download a clone/snapshot of the website? This way, I'll be able to troubleshoot, without making changes to the actual website.

#2375071

Sure, no problem. I already installed Duplicator, so you can go ahead.

#2375073

I just received these error details on the admin mail address. I think it was generated when one of the templates was opened for editing:

An error of type E_ERROR was caused in line 67 of the file /home/website/website_com/stg/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/Sources/PostContent.php. Error message: Uncaught Error: Attempt to assign property "dynamic_sources_content_processed" on null in /home/website/website_com/stg/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/Sources/PostContent.php:67
Stack trace:
#0 /home/website/website_com/stg/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/DynamicSources.php(514): Toolset\DynamicSources\Sources\PostContent->get_content(NULL, NULL)
#1 /home/website/website_com/stg/wp-includes/class-wp-hook.php(307): Toolset\DynamicSources\DynamicSources->get_source_content('', '__current_post', 1881, Object(Toolset\DynamicSources\Sources\PostContent))
#2 /home/website/website_com/stg/wp-includes/plugin.php(191): WP_Hook->apply_filters('', Array)
#3 /home/website/website_com/stg/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/Cache.php(92): apply_filters('toolset/dynamic...', '', '__current_post', '1881', 'post-content')
#4 [internal function]: Toolset\DynamicSources\Cache->get_data_for_sources(Array, '__current_post', '1881')
#5 /home/website/website_com/stg/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/Cache.php(49): call_user_func_array(Array, Array)
#6 /home/website/website_com/stg/wp-includes/class-wp-hook.php(307): Toolset\DynamicSources\Cache->add_cached_data(Array, '1881')
#7 /home/website/website_com/stg/wp-includes/plugin.php(191): WP_Hook->apply_filters(Array, Array)
#8 /home/website/website_com/stg/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/DynamicSources.php(967): apply_filters('toolset/dynamic...', Array, 1892)
#9 /home/website/website_com/stg/wp-includes/class-wp-hook.php(307): Toolset\DynamicSources\DynamicSources->get_dynamic_sources_data(Array)
#10 /home/website/website_com/stg/wp-includes/plugin.php(191): WP_Hook->apply_filters(Array, Array)
#11 /home/website/website_com/stg/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/DynamicSources.php(942): apply_filters('toolset/dynamic...', Array)
#12 /home/website/website_com/stg/wp-includes/class-wp-hook.php(307): Toolset\DynamicSources\DynamicSources->register_localization_data('')
#13 /home/website/website_com/stg/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array)
#14 /home/website/website_com/stg/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
#15 /home/website/website_com/stg/wp-admin/edit-form-blocks.php(270): do_action('enqueue_block_e...')
#16 /home/website/website_com/stg/wp-admin/post.php(187): require('/home/website/...')
#17 {main}
thrown

#2376067

Thank you for the permission and I've downloaded the Duplicator package.

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

Thank you for your patience.

#2376985

Just wanted to let you know that I'm still working on this.

The nature of this troubleshooting turns out to be more complex than I initially anticipated, but I'll keep you updated with the progress.

#2377091

No problem, thank you for letting me know. Can you reproduce the problem on your end?

#2379297

Thank you for waiting and yes, I was able to reproduce the problems with the editing of those content templates.

Here are my findings:

1. Content template "Tmp Towns-Search-Towns"

This template is showing an error because it is set to use a post/page with an ID "1881" for preview, but this post/page no longer exists on the website.

As the template itself is not editable, you can place the following code at the bottom of your child theme's "functions.php" file, which will replace the preview post/page ID for this template:


update_post_meta( 1892, 'tb_preview_post', '679', '1881' );

After this, visit the website's homepage a few times and the content template will become available for editing.
( you can change the preview post/page after that from the "View with" field at the top: hidden link )

Once the template is fixed, you can remove the code from the "functions.php" file.

2. Content template "Tmp Travel ticket"

I've tested this on a couple of different testing servers, but the issue with this content template was inconsistent.

Sometimes the views inside this content template are loaded completely and sometimes they are not. This suggests that it is due to the long length of the content or usage of many (9) views.

I'm still doing some tests around this specific loading issue and will share the findings, by the end of the day today.

#2379299

{ticket status updated}

#2379343

Hi Waqar,

1. Thanks a lot, that fixed it indeed! I guess this is something to improve in Toolset? I mean, it's not possible for users to keep track of which posts have been used for a preview. So this can happen at any time, particularly in bigger sites. It would be best if Toolset had a fallback mechanism if the preview post can't be found.

2. Yes, many views in that template. I don't think I can limit the number of views because it's not possible to combine post types in the same view if they need different filters.
Meanwhile I have migrated the site from a "large" shared hosting plan with 4Gb RAM to a VPS with 6 Mb RAM. I opened the template again and this time it fully loaded, but it took a long time. Also I noticed that Toolset keeps refreshing the data: it shows "Loading" every now and then for parts that were loaded already. Perhaps it's attempting too many refreshes, and sometimes this fails or taking forever. I can add even more RAM or CPU cores but I'm not sure if that's the right approach. It's still a small site in development, with no users other than myself.

Thanks,
Arno

#2380129

By the way, I noticed that the template "Tmp Activity" containing 8 views loads just fine. Once opened though (in edit mode), it's not particularly quick to work with. It keeps showing "Processing server request, please wait..."

#2380169

We already have an internal ticket to improve the fallback mechanism for the deleted posts, when set for preview and I've also added your ticket to this.

WordPress' new Gutenberg (blocks-based) editor comes with an active preview screen, which continuously syncs the data using the REST API. As a result, it can feel a bit slow compared to the classic editor where no preview was involved.

There is also an autosave feature that is running frequently in the background scanning for changes and saving them.
( you'll note that during that processing, the update button is also disabled )

A couple of things that you can do to improve this editing experience:

1. You can increase the value of the autosave interval so that the autosave processing happens less often:
hidden link

2. Your website seems to be served through Cloudflare. It would be a good idea to exclude its features for the admin pages:
hidden link

Additional tip: You can also restrict the number of view results shown in the blocks editor's preview screen to a smaller number, by using the "wpv_filter_query" filter, for example:
( ref: https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query )


add_filter( 'wpv_filter_query', 'limit_view_preview_posts_func', 1000 , 3 );
function limit_view_preview_posts_func( $query_args, $view_settings ) {
    // only if blocks edit screen
    if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
        $query_args['posts_per_page'] = 2;
        $query_args['wpv_original_limit'] = 2;
    }
    
    return $query_args;
}

The above code snippet 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.

After this code, all your views in the block editor preview will only bring in two results, however, on the front-end, the results will continue to show as per the view's settings.