I just completed 14 Days of WordPress Plugins + 7 Bonus Plugins!

Patch: Dealing with multiple <!–more–>

Bug 0000113 is titled “Post content ‘lost’ if multiple <!–more–> (more…) tags used“. Which basically says that if more than 1 <!–more–> tag is located in the content of a post, you’d only ever see the text up to the second <!–more–>. All subsequent text, though still part of the post content in the database, will never be displayed. The fix is extremely simple:

In wp-includes/template-functions-post.php, in the function get_the_content(), change this line:

$content = explode('&lt&;!--more-->', $content);

to this:

$content = explode('&lt&;!--more-->', $content, 2);

The third argument to explode(), the limit arg, was introduced in PHP 4.0.1, and since WP supports PHP 4.1, the fix should be valid. This way text before the first <!–more–> will be put into $content[0] (as expected), and all other post content, regardless of subsequent <!–more–> tags, will be put into $content[1] and therefore not “lost”.

Here is the patch (modified from, and then compared against, the latest WP 1.3 from CVS).

One Response to “Patch: Dealing with multiple <!–more–>”

  1. Is this the way to paginate a post, if’s not. How i can make long posts paginating them? Thx

Leave a Reply

Please keep these things in mind:
Comments may be moderated.
Don't say obviously spammy words (poker, penis, etc)
Basic HTML allowed: i, b, code
Wrap code examples in code tags.