Subscribe to
Posts
Comments
NSLog(); Header Image

WordPress Bug in 2.6.x: Sandwiched ‘more’ Tag

I reported a bug to Adriaan of ecto, which helped me to confirm that there's really no bug in ecto, but rather more likely in WordPress. The bug - or at the very least change in behavior - has to do with the manner in which the <--more--> tag is applied when submitting posts via an XML-RPC client.

Prior to WordPress 2.6, the tag was put on its own line, like this:

Cras ut orci id nisl semper interdum. Aenean molestie.
<!--more-->
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.

This meshed well with the way WordPress handled its auto-paragraphing, wrapping <p> tags around the text above and below the <!--more--> tag. In WordPress 2.6.0 and 2.6.1, this tag sandwiched between the "entry" and the "extended entry" as follows:

Cras ut orci id nisl semper interdum. Aenean molestie.<!--more-->Lorem ipsum dolor sit amet, consectetuer adipiscing elit.

The fix is fairly simple. Find two instances of code that look like this:

if ($post_more) {
    $post_content = $post_content . "<!--more-->" . $post_more;
}

and change them to look like this.

if ($post_more) {
    $post_content = $post_content . "\n<!--more-->\n" . $post_more;
}

Note that you have to do this twice in the xmlrpc.php file.

I've submitted the bug to TRAC as #7686.