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 thought on “Patch: Dealing with multiple <!–more–>

Comments are closed.