Content over 10,000 characters won’t display with the_content()

A friend of mine just noticed that their site wasn’t displaying pages that had a lot of content. For some reason they are just blank, and if he removes some content from the page it will display again. The 10,000 character mark seems to be the threshold – anything above and it goes blank.

I played with his templates and noticed that the content would be displayed if I used echo get_the_content() rather than the_content(), but then he loses the auto-formatting.

Read More

Has anyone run into this issue before? I’ve googled around and searched this site but haven’t been able to find anything. Thanks in advance for any light you can shed on this!

Related posts

Leave a Reply

1 comment

  1. I ran into this problem a year or so ago, and found a fix here.

    • Open PHP.INI in a text editor of your choice (normally you can find php.ini in your php install dir)
    • Change the recursion limit to 200x normal, that is, set: pcre.recursion_limit=20000000
    • Change the backtrack limit to 100x normal, that is, set: pcre.backtrack_limit=10000000
    • Stop and start the Apache (or IIS) service

    As a warning note, if you push this too far and your server is underpowered, you may end up crashing PHP as it consumes the entire stack. Your host may not be too happy about that.

    If you don’t have access to your php.ini, you can set these variables inside wp-config.php. Somewhere before the require_once(ABSPATH . 'wp-settings.php');, maybe in the debug area (up to you), add these two lines:

    @ini_set('pcre.backtrack_limit', 10000000);

    @ini_set('pcre.recursion_limit', 20000000);