Fix: WordPress Post Content Disappears with Too Many Shortcodes

Web Design & Development

I’ve been working on a longer post that I plan on splitting up over several pages. It’s a tutorial/walkthrough that includes a lot of images. Everything was going great until I decided to preview the post. For some reason when I viewed the post, it would only show the post title and metadata, but not the actual content of the post.

Where did all my content go?
My post would not display any content; it only showed the post title and metadata

I closed the preview and went back to the post’s edit page to see if I could find any issues. I didn’t see anything wrong with the HTML or the shortcodes, so I decided to start deleting sections of the post to try and narrow down the issue.

After a lot of trial-and-error, I discovered that the content would show up if I left all of the content up to the first 11 images and about 100 characters after the 11th image. If I added one more character, the post content wouldn’t show up when I previewed the post.

After a few minutes of google-fu I came across a potential solution. Apparently posts with a lot of shortcodes (such as the shortcode used for images) can suffer from this issue. I wasn’t able to determine the exact combinations of shortcodes and words a post can have before it “breaks,” but I found this post on the support section that suggested editing the wp-config.php file on my web server and increasing the memory and backtrack limit. I also found this post that suggested increasing the recursion limit as well. I added the following lines of code to the top of my wp-config.php file:

define('WP_MEMORY_LIMIT', '64M');
ini_set('pcre.recursion_limit', 20000000);
ini_set('pcre.backtrack_limit', 1000000);

The first several lines of my wp-config.php file now look like this:


define('WP_MEMORY_LIMIT', '64M');
ini_set('pcre.recursion_limit', 20000000);
ini_set('pcre.backtrack_limit', 1000000)

 * The base configurations of the WordPress.
 * This file has the following configurations: MySQL settings, Table Prefix,
 * Secret Keys, WordPress Language, and ABSPATH. You can find more information by
 * visiting {@link Editing
 * wp-config.php} Codex page. You can get the MySQL settings from your web host.
 * This file is used by the wp-config.php creation script during the
 * installation. You don't have to use the web site, you can just copy this file
 * to "wp-config.php" and fill in the values.
 * @package WordPress

This did the trick, and I didn’t even have to restart my Apache server to get it to work! I’m sure this isn’t a cure-all for everyone who encounters this issue, but hopefully it will be helpful to someone.


  1. Well done and thank you very much for sharing! This alleviates the need to dive into the php.ini, base wordpress functions, or wordpress theme templates. This is an override that I can actually live with that is non intrusive and gets it done. Thank you very much!
  2. I've been looking for this solution forever, thank you so much!
  3. Hi Josh, I tried the fix, turns out there's an error now "Parse error: syntax error, unexpected T_STRING in /home2/arcadcom/public_html/test/wp-config.php on line 24" This shows up after i added the 3 lines of code you mentioned. My page crumbles coz of shortcodes too. Any suggestions? Much Thanks Ash
    1. Got rid of the error, but the page still does not show up when the shortcodes are used..
      1. Hey Ash, It's hard to say, your site may have some other configuration that prevents this fix from working. You hosting provider might enforce additional limitations, for example. Who is your host? How many shortcodes are you using?
  4. Would this shortcode help resolve this sort of issue: ? Basically, the table's contents stops short. This also happens when I edit other pages. The minute I preview/update, I lose 99% of my content. I've updated my WP and deactivated plugins. I don't suspect the code in my theme is off either, as this problem appeared only recently and the code hasn't changed in 2 weeks. Thanks!

Comments are closed