apply_filters in template crashes browser #6617
Replies: 6 comments
-
Something doesn't add up here, Beyond that, I'm not sure what's going on here with the crashing, what other plugins do you have activated? |
Beta Was this translation helpful? Give feedback.
-
Can confirm. {@post_content} makes my page loading in loop and ultimately going "blank". Calling the_content filter directly crashes the whole browser. I managed to make it work in some way by using field('post_content')); ?> I'm using not so many plugins other than Pods (SiteOrigin's Page Builder, LayerSlider). I'd try to disable everything other than this but I'm working in a semi-production setup. I'll check soon on a clean install and let you know. |
Beta Was this translation helpful? Give feedback.
-
It sounds like there's an infinite loop going on here with the_content, some plugin may be hooking into it but not removing / disabling itself so it continues to process additional the_content calls embedded within. |
Beta Was this translation helpful? Give feedback.
-
The infinite loop is caused by the apply_filters() function. If you want to avoid using the apply_filter() function while displaying the well formatted content, you can use the wpautop() function with a content display function (like get_post_field or get_the_content ...). |
Beta Was this translation helpful? Give feedback.
-
Best practice is to remove your filter at the start of your content filter function, then add it back at the end, to avoid recursion loops. |
Beta Was this translation helpful? Give feedback.
-
This solution with remove_filters() function does not work in my plugin (Modal-Portfolio), that's why I found another solution with wpautop() (which is called by apply_filters when we want to recover formatted content ...). |
Beta Was this translation helpful? Give feedback.
-
[WP v. 4.1.3 - Pods v. 2.5.1.2]
So I discovered that {@post_content} does not work, so I am using $obj->field('post_content') to print the post content in template. Moreover, when I try to apply filters, like by using
field('post_content')); ?>firefox crashes.
Beta Was this translation helpful? Give feedback.
All reactions