Problem updating posts containing <–more–> tag via XML-RPC

  • Unknown's avatar

    I am using a Python program (http://srackham.wordpress.com/blogpost1/) to write and update blogposts on wordpress.com via XML-RPC.

    I have been having problems with updating posts containing the more tag – it seems that it is impossible to overwrite the <–more–> tags in the existing post via XML-RPC:

    Step 1: Create post

    I send:
    <p>First row.</p> <!–more–> <p>Second row.</p>

    wordpress.com displays:
    <div class=’snap_preview’><p>First row.</p>
    <p> <span id=”more-1921″></span>
    <p>Second row.</p>
    </div>

    That’s fine.

    Step 2: Edit the post, add third row of text and update the post created in Step 1.

    I send:
    <p>First row.</p> <!–more–> <p>Second row.</p><p>Add third row.</p>

    wordpress.com displays:
    <div class=’snap_preview’><p>First row.</p>
    <p> <span id=”more-1921″></span>
    <p>Second row.</p>
    <p>Add third row.</p>
    <p><!–more–>
    <p>Second row.</p>
    </div>

    Notice that now “Second row” appears twice in the post.

    Step 3: OK, decided to have no more-tags in the post, and update the post created in Step 2.

    I send:
    <p>First row.</p> <p>Second row.</p> <p>Add third row.</p>

    wordpress.com result:
    <div class=’snap_preview’><p>First row.</p>
    <p>Second row.</p>
    <p>Add third row.</p>
    <p><span id=”more-1921″></span>
    <p>Second row.</p>
    <p>Add third row.</p>
    <p><!–more–>
    <p>Second row.</p>
    </div>

    “Second row” appears now three times (the original + 2 updates). The more-tag(s) are also there.

    To get updates to behave normally I had to delete the repost. Updating posts without <–more–> tag works without any problems.

    Tried searching the forum, but could not find anything similar.
    Is this a bug, or the supposed way things should work?

    The blog I need help with is: (visible only to logged in users)

  • You don’t mention which XML-RPC method you are calling for this. I’m going to assume metaWeblog.editPost (and metaWeblog.newPost to create one).

    Instead of including the <!–more–> as part of the post content use the code mt_text_more field. When a value is detected in that field WP builds the post content like this ($post_more has the value for the mt_text_more field):

    $post_content = $post_content . "<!--more-->" . $post_more;

    So WP takes care putting together the post for you.

  • The topic ‘Problem updating posts containing <–more–> tag via XML-RPC’ is closed to new replies.