WordPresss 2.5

WordPress 2.5 is officially out the door. Matt hits the long list of highlights of what is new in the release announcement. This coincides with the new layout at WordPress.rog. Peter Westwood (one of the WordPress core developers) put together a tag cloud of people who contributed to this release.

For the XML-RPC blog client developers out there 2.5 adds four new methods:

  • wp.deleteCategory( blog_id, username, password, category_id ) – Delete a category.
  • wp.getCommentCount( blog_id, username, password, post_id ) – Provides a struct of all the comment counts ( approved, awaiting_moderation, spam, total_comments ) for a given post_id. The post_id parameter is optional (or can be set to zero), if it is not provided then the same struct is returned, but for the entire blog instead of just one post.
  • wp.getPostStatusList( blog_id, username, password ) – Provides a struct of all the valid post statuses ( draft, pending, private, publish ) and their descriptions ( Draft, Pending Review, Private, Published ).
  • wp.getPageStatusList( blog_id, username, password ) – Provides a struct of all the valid page statuses ( draft, private, publish ) and their descriptions ( Draft, Private, Published).

To go along with the new status methods, you can now explicitly set the post and page status using the post_status and page_status fields. Like wise the status is also exposed via the various get* methods. One note about future posts, for the purposes of XML-RPC clients we set the post_status to publish when the actual database value is future.

The wp.suggestCategories method has been fixed to return data in the same format that it did originally. I never heard anyone complain about this though, so I guess it isn’t getting much use.

Custom fields for posts and pages are now exposed and manageable from metaWeblog.getPost/newPost/editPost, wp.getPage/newPage/editPage via the custom_fields field. I was really happy to get this in, I think there is a lot of potential in being able to manage custom fields externally.

The mt_allow_comments field now understands the value of 2 to be the same as the value of zero. This was done because other platforms expect to be able use the value 2, so some clients assume that we support it. Now we do, but from the WordPress point of view is does exactly the same thing as zero.

If the field date_created_gmt is provided in metaWeblog.newPost/editPost, wp.newPage/editPage then it is used instead of the dateCreated field. This same field was already exposed via metaWeblog.getPost, wp.getPage. By definition the date_created_gmt field is always GMT, even if you don’t provide a time zone offset or a trailing Z. I’m hoping this will help ease the many headaches that have been brought on by trying to deal with date/time issues in the XML-RPC blog APIs.

If you are a developer that makes use of the WordPress XML-RPC interface, or are interested in doing development work on the WordPress XML-RPC code please subscribe to the wp-xmlrpc email list. Along with various tickets in Trac this is where we discuss ideas and issues for the XML-RPC APIs that WordPress supports.

10 thoughts on “WordPresss 2.5”

  1. @Joseph

    Just upgraded to 2.5. Much cleaner, simpler interface. I love the ease of upgrading plugins. The new media capabilities are amazing. Hope you’re doing well.

  2. This is the only web site that references the new custom_fields feature. Is there documentation available somewhere for the API side, should the custom_fields be an array of structs with each struct having a key and value with an optional id?


  3. I joined the mailing list.

    I did a test and it appears my assumption was right, the custom_fields is an array of structs. Each struct should contain a key and value. A struct should also include the custom field ‘id’ if the struct is updating an existing custom field. Otherwise the struct should only include the key and value to insert a new custom field.

    WordPress is awesome!

  4. Thanks for the post summing up the WP 2.5 rpc changes…. Just wondering what format date_created_gmt should be in as I had unresolved problems with “Call to a member function getIso() on a non-object” and dateCreated

  5. @Wdiget Guy –

    The getIso error was recently brought up in a ticket:


    I haven’t asked for that patch to be committed yet, I’m waiting for feedback from some of the current blog clients before we mess with date/time settings, which have proved to be very sensitive in the past.

    To answer your question about date_created_gmt, just the standard YYYYMMDDTHH:MM:SSZ format.

  6. Thanks for the quick reply Joseph…. My code was busted thus it was throwing that error… changing the date type from string to dateTime.iso8601 and using $date_created = date(“YmdTH:i:sZ”, mktime(…..)) worked!

  7. Hi Joseph — thanks for all of the great info.

    I have a follow up question on date/time. I’m writing a Java app using the redstone xmlrpc library.

    Whenever I set the postCreated field, WP interprets/modifies the timezone to GMT. For the time being, I’ve kludged the date (adding the difference between the local TZ and GMT) so that WP gets the post date right.

    I’m using the java.util.Date class for the postCreated parameter.

    Any thoughts on whats going on here? btw, I’ve had zero luck in getting date_created_gmt to work properly.



  8. Thanks Joesph

    I just signed up for the email list and posted the following there:

    I’m writing a Java app using the redstone xmlrpc library and having a problem with both postCreated and date_created_gmt

    Whenever I set the postCreated field, WP interprets/modifies the timezone to GMT. For the time being, I’ve kludged the date (adding the difference between the local TZ and GMT) so that WP gets the post date right. This is ugly and I’d rather not do this . . .

    It’s been suggested that I use the date_created_gmt field, but I’ve had zero luck getting this to work. It seems that WP doesn’t recognize the passed in java.util.Date as a valid date and subsequently defaults to the current date.

    Any thoughts on whats going on here? Anyone care to share some working code?

    Here’s a snipet of what I’m doing . . .

    HashMap content = new HashMap();

    java.util.Date postDate;

    Calendar c = Calendar.getInstance();
    c.add(Calendar.Days, 7);

    postDate = c.getTime();

    // System.out.println(postDate); yeilds

    // snip . . .
    // title, keywords, category, description, etc. are all populated . . .

    content.put(“categories”, new String[]{category});
    content.put(“post_status”, “publish”);
    content.put(“description”, articlebody);
    //content.put(“date_created_gmt”, postDate); // date doesn’t get interpretted correctly and defaults to the current date
    content.put(“dateCreated”, postDate); // date is offset by local TZ – GMT

    Object[] params = new Object[]{new String(“n/a”), user, pass, content, new Boolean(“true”)};
    Object token;
    try {
    token = client.invoke(“metaWeblog.newPost”, params);
    } catch (XmlRpcException ex) {
    Logger.getLogger(WPDripFeederView.class.getName()).log(Level.SEVERE, null, ex);
    } catch (XmlRpcFault ex) {
    Logger.getLogger(WPDripFeederView.class.getName()).log(Level.SEVERE, null, ex);

Leave a Reply

Your email address will not be published. Required fields are marked *