WordPress.org

Support

Support » How-To and Troubleshooting » XML-RPC problems in WP 2.00

XML-RPC problems in WP 2.00

  • I am testing new WP 2.00 with Post2Blog blogging client for Windows that uses MetaWeblog/MovableType XML-RPC API to make new posts and edit existing posts and it seems like extended entires are not supported anymore (WP 1.5.x works fine).

    Problems:
    1. When extended entry field is supplied in XML-RPC request then the whole entry is mixed with extended entry so no way to set extended entry via XML-RPC
    2. When you edit post previously posted via XML-RPC then you can’t see <!–more–> tag that separates main and extended entry.

    I believe the problems are in the implementation for MetaWeblog.NewPost and MetaWeblog.EditPost methods so is there any bug-fixes or patches for this problem?

    Example:
    XML-RPC request to add edit/add new post:

    <?xml version=”1.0″?>
    <methodCall>
    <methodName>metaWeblog.editPost</methodName>
    <params>
    <param>
    <value><string>97</string></value>
    </param>
    <param>
    <value><string>USERNAME</string></value>
    </param>
    <param>
    <value><string>PASSWORD</string></value>
    </param>
    <param>
    <value>
    <struct>
    <member>
    <name>title</name>
    <value><string></string></value>
    </member>
    <member>
    <name>description</name>
    <value><string>main text</string></value>
    </member>
    <member>
    <name>mt_text_more</name>
    <value><string>more text goes here</string></value>
    </member>
    <member>
    <name>mt_allow_comments</name>
    <value><int>1</int></value>
    </member>
    <member>
    <name>mt_allow_pings</name>
    <value><int>1</int></value>
    </member>
    <member>
    <name>mt_excerpt</name>
    <value><string></string></value>
    </member>
    </struct>
    </value>
    </param>
    <param>
    <value><boolean>0</boolean></value>
    </param>
    </params>
    </methodCall>

    Then download posted entry and you can see that returned “mt_text_more” field now is empty:

    <?xml version=”1.0″?>
    <methodResponse>
    <params>
    <param>
    <value>
    <data>
    <value><struct>
    <member><name>dateCreated</name><value><dateTime.iso8601>20060105T13:32:48</dateTime.iso8601></value></member>
    <member><name>userid</name><value><string>2</string></value></member>
    <member><name>postid</name><value><string>97</string></value></member>
    <member><name>description</name><value><string>main text

    other text goes here</string></value></member>
    <member><name>title</name><value><string></string></value></member>
    <member><name>link</name><value><string>http://picturelli.com/Post2Blog_TestBlog/?p=97</string></value></member&gt;
    <member><name>permaLink</name><value><string>http://picturelli.com/Post2Blog_TestBlog/?p=97</string></value></member&gt;
    <member><name>categories</name><value><data>
    <value><string>Sample Category 1</string></value>
    </data></value></member>
    <member><name>mt_excerpt</name><value><string></string></value></member>
    <member><name>mt_text_more</name><value><string></string></value></member>
    <member><name>mt_allow_comments</name><value><int>1</int></value></member>
    <member><name>mt_allow_pings</name><value><int>1</int></value></member>
    </struct></value>
    </data>
    </value>
    </param>
    </params>
    </methodResponse>

Viewing 4 replies - 1 through 4 (of 4 total)
  • Oh I found a solution on how to prevent WordPress from mixing extended entry with main entry when posting via XML-RPC client. Seems like new WP2 removes all kind of HTML comments and unknown tags from posted HTML code.

    How to fix:

    in /wp-includes/ sub-folder find a file called “functions-post.php”:

    Open it and find and comment the following line:

    $post_content = apply_filters(‘content_save_pre’, $post_content);

    So you will get something like this:

    // Get the basics.
    /* commented by Eugene Mironichev – http://www.bytescout.com
    to prevent removing of <!–more–> from post added via xml-rpc
    $post_content = apply_filters(‘content_save_pre’, $post_content);
    */
    $post_excerpt = apply_filters(‘excerpt_save_pre’, $post_excerpt);
    … etc

    Will add ticket about this into bug tracker but not sure if this is a bug or feature of WordPress 2.

    This is still a problem

    My integrated code is disappearing

    So I commented as so
    /*
    *$post_content = apply_filters(‘content_save_pre’, $post_content);
    */

    Now the source code stays when I view through my ftp. But when I view through my browser, my code is gone.

    http://www.kiplingcitizen.com/temp.html

    Missing code is just towards the end.

    <td width=”16%”><img src=”graphics/left-banner.gif” align=”top” alt=”advertise” /></td>
    <td width=”68%”><?php require(‘/u/k/kcit0806/www.kiplingcitizen.com/wp-blog-header.php’); ?></td>
    <td width=”16%”><img src=”graphics/left-banner.gif” align=”top” alt=”advertise” /></td>

    I discovered that when the code disappears, the function is operating correctly.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘XML-RPC problems in WP 2.00’ is closed to new replies.