Skip Navigation

[Resolved] PHP fatal error when trying to edit a Content Template

This support ticket is created 2 years, 6 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/Hong_Kong (GMT+08:00)

This topic contains 6 replies, has 2 voices.

Last updated by saulB-3 2 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#2198601
Screen Shot 2021-10-17 at 23.42.34.png

Hi there,

I'm trying to edit a specific Content Template on my website ("Content template for Clients 4"). The edit link is below:

hidden link

When I try to access the page, the web browser appears to stall until PHP times out. See the attached screenshot. (This screenshot is actually from a copy of the website that lives on my desktop computer and suffers from the same issue.)

I've disabled all plugins except Toolset Types and Toolset Blocks and tried to edit the content template, without success. I have exported the Types settings and re-imported them, and trying to edit the content template then was still unsuccessful.

Perhaps I can provide server credentials for you to access my site?

Thank you.

Saul

PS. To work around this issue, I have duplicated the Content Template and edited the duplicate copy. After editing the duplicate content template once, it is no longer editable. If I try to edit it again, the same script timeout as pictured in the screenshot will appear.

#2198711

Hello,

The problem you mentioned above is abnormal, please provide a copy of your website in below private message box, you can put the package files in your own google drive disk, share the link only, I need to test and debug it in my localhost, thanks
https://toolset.com/faq/provide-supporters-copy-site/

#2199317

I am downloading the files, will update here if find anything

#2199331
not-empty-body.png

I assume you are going to check the post content is empty, then output something.

If it is, please try these:
1) Add below codes into your theme file functions.php

function wpv_is_content_empty(){
  global $post;
  $content = force_balance_tags($post->post_content);
  $content = preg_replace('#<p>\s*+(<br\s*/*>)?\s*</p>#i', '', $content); // remove empty HTML P AND BR tags 
  $content = preg_replace('/<!--(.*)-->/Uis', '', $content); // remove empty HTML comment tag <!-- -->
  $content = trim($content);// remove empty spaces
  if (strlen( $content ) == 0){
    return 1;
  } else {
    return 0;
  }
}

2) Dashboard-> Toolset-> Settings-> Front-end Content, in section "Functions inside conditional evaluations", add above PHP function name: wpv_is_content_empty

3) Trash and remove the problem content template "Content template for Clients 4", create a new content template, and setup the conditional block with below condition:
The result of ts_is_content_empty() is equal to 0.
See my screenshot not-empty-body.JPG

#2200229
Screen Shot 2021-10-19 at 23.21.03.png

Luo,

Thanks for your reply. I'm very confused. You mentioned that you're assuming I'm "going to check [if] the post content is empty, then output something." I'm not trying to do that. I'm simply trying to edit the Content Template: I'm clicking the title of the template on the WordPress dashboard (see attached), waiting several minutes, and seeing the PHP error.

Is there something I'm missing?

Saul

#2200347

I have checked it in database, in the "Content template for Clients 4", there is a conditional block is using setting: check the post content is empty

It using [wpv-post-body ...] shortcode in the condition, and conduct endless loop issue, and conduct the problem you mentioned above.

Please try as I mentioned above:
Trash and remove the problem content template "Content template for Clients 4", create a new content template
https://toolset.com/forums/topic/php-fatal-error-when-trying-to-edit-a-content-template/#post-2199331

If you don't need to check the post body, then you just need setup it again manually.

#2201205

This seems to have fixed the issue. I'm able to view the edit page of the content template repeatedly. So odd, but thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.