Missing content in long WordPress posts

wordpress_iconI’ve just spent several hours struggling with an annoying WordPress problem: when I edited a post to make some additions, it suddenly stopped displaying any content. The title, header and footer were still visible, only the post body itself was missing.

After a bit of poking around, I came across this post. It points out the root cause of the problem is the PHP regular expression engine (PCRE) that WordPress uses.

The easiest way to fix the problem is to ignore the advice in that post about modifying formatting.php, and instead make the fix to PHP.INI which is mentioned in the comments. I edited my copy to include the following line, which increases the backtracking limit from the default of 100000:

pcre.backtrack_limit = 1000000

After getting IIS to pick up the changes (iisreset) my missing content appeared again.