[wp-xmlrpc] Handling Custom Post Types in WP 3.0 via XMLRPC
Eric Mann
eric at eamann.com
Thu Jul 8 03:42:30 UTC 2010
David,
Any chance you can post a snippet (better yet a diff) showing what exactly
you changed to support your custom post types? If possible, I'd like to
generalize it and submit a formal patch .
From: wp-xmlrpc-bounces at lists.automattic.com
[mailto:wp-xmlrpc-bounces at lists.automattic.com] On Behalf Of David Weiss
Sent: Wednesday, July 07, 2010 6:07 PM
To: wp-xmlrpc at lists.automattic.com
Subject: [wp-xmlrpc] Handling Custom Post Types in WP 3.0 via XMLRPC
FYI, I wanted to use Custom Post Types and WP 3.0 in a new blog and manage
content via XMLRPC.
XMLRPC.php isn't updated to handle this, it seems.
mw_NewPost just needs a tweak to get it to work.
1993 $post_type = 'post';
1994 $page_template = '';
1995 if ( !empty( $content_struct['post_type'] ) ) {
1996 if ( $content_struct['post_type'] == 'page' ) {
1997 $cap = ( $publish ) ? 'publish_pages' : 'edit_pages';
1998 $error_message = __( 'Sorry, you are not allowed to
publish pages on this site.' );
1999 $post_type = 'page';
2000 if ( !empty( $content_struct['wp_page_template'] ) )
2001 $page_template =
$content_struct['wp_page_template'];
2002 } elseif ( $content_struct['post_type'] == 'post' ) {
2003 // This is the default, no changes needed
2004 } else {
2005 // No other post_type values are allowed here
2006 return new IXR_Error( 401, __( 'Invalid post type.' )
);
2007 }
2008 }
I just edited up the if/elseif/else to take into account my custom post type
names, and set the post_type key/value to the appropriate post type in my
client.
Works fine so far.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.automattic.com/pipermail/wp-xmlrpc/attachments/20100707/4cc9cbd4/attachment.htm>
More information about the wp-xmlrpc
mailing list