Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeout issue with apply_filters('the_content', $content); #47

Closed
zetokore opened this issue Mar 16, 2015 · 7 comments
Closed

Timeout issue with apply_filters('the_content', $content); #47

zetokore opened this issue Mar 16, 2015 · 7 comments

Comments

@zetokore
Copy link

If I throw a shortcode in the Visual Editor, i.e.

[callout]MY CONTENT[/callout]

And if I'm doing this with that shortcode's content:

<?php echo apply_filters('the_content', $content); ?>

The page time's out.

@zetokore
Copy link
Author

If I replace this:

<?php echo apply_filters('the_content', $content); ?>

With this:

<?php echo $content; ?>

it resolves the issue, but I need that content filtered. :)

@gregpriday
Copy link
Member

Just to confirm, do not get this issue when Page Builder is deactivated?
Also, where are you getting that shortcode from? Is it from a plugin or
have you custom coded it?

On Monday, March 16, 2015, SteveS123 notifications@github.com wrote:

If I replace this:

With this:

it resolves the issue, but I need that content filtered. :)


Reply to this email directly or view it on GitHub
#47 (comment)
.

I make free WordPress themes
http://siteorigin.com

@zetokore
Copy link
Author

That's right, if I have the Page Builder deactivated and paste my shortcode into the standard visual editor it works fine. The shortcode is custom coded, I've stripped everything out from it, the shortcode below exhibits the bug:

function callout( $atts, $content = null ) {

    if(has_filter('callout'))
        return apply_filters('callout', $atts, $content);

    extract(shortcode_atts(array(), $atts));
    ob_start();

    apply_filters('the_content', $content);

    $output_string = ob_get_contents();
    ob_end_clean();
    return $output_string;
}
add_shortcode('callout', 'callout');

@gregpriday
Copy link
Member

I can see how that would cause an infinite loop. I'll take a look at that
when I'm back at my office and see if I can figure anything out.

One fairly simple fix would be to remove the Page Builder filters on
the_content and readd them afterwards. That's a bit of a hack though. I'd
rather try see if I can get Page Builder itself to deal with this situation.

On Monday, March 16, 2015, SteveS123 <notifications@github.com
javascript:_e(%7B%7D,'cvml','notifications@github.com');> wrote:

That's right, if I have the Page Builder deactivated and paste my
shortcode into the standard visual editor it works fine. The shortcode is
custom coded, I've stripped everything out from it, the shortcode below
exhibits the bug:

function callout( $atts, $content = null ) {

if(has_filter('callout'))
    return apply_filters('callout', $atts, $content);

extract(shortcode_atts(array(), $atts));
ob_start();

apply_filters('the_content', $content);

$output_string = ob_get_contents();
ob_end_clean();
return $output_string;

}
add_shortcode('callout', 'callout');


Reply to this email directly or view it on GitHub
#47 (comment)
.

I make free WordPress themes
http://siteorigin.com

@zetokore
Copy link
Author

zetokore commented Apr 6, 2015

I don't suppose you could suggest a simple hack to work around this issue in the meantime?

@MathieuChartier86
Copy link

I had the same conflict between my plugin Modal -Portfolio and Page Builder.

This is the alternative that works:
wpautop(get_post_field('post_content', $post->id));
(It should perhaps change $post->id depending on your configuration)

The cause of this conflict is simple : it is not possible to use apply_filters function in another apply_filters function (already used by Page Builder).

As apply_filters() function uses the wpautop() function to add line breaks, just use this function to solve the problem with any displaying function for the content. :-)

Note: I'm French, sorry for my bad English ...

@braamgenis
Copy link
Contributor

Thanks for the input @Internet-Formation That's a good suggestion.

@SteveS123 You can also take a look at the default-filters.php file and apply only the filters you need. Otherwise the editor will try to process your shortcode over and over again. Hope that helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants