WordPress extended XML-RPC MetaWeblog API
Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!
XML-RPC MetaWeblog API
WordPress supports the metaWeblog XML-RPC API, augmented with additional WordPress-specific functionality (denoted by †) . This support was added in WordPress 1.5.0.
Contents
metaWeblog.getPost
Retrieve a post.
Parameters
- int postid
- string username
- string password
Return Values
- struct
- int postid†
- string title
- string description: Post content.
- string link: Post URL.
- string userid†: ID of post author.
- datetime dateCreated†
- datetime date_created_gmt†
- datetime date_modified† (Added in WordPress 3.4)
- datetime date_modified_gmt† (Added in WordPress 3.4)
- string wp_post_thumbnail†
- string permaLink†: Post URL, equivalent to link.
- array categories: Names of categories assigned to the post.
- string mt_keywords: Names of tags assigned to the post.
- string mt_excerpt
- string mt_text_more: Post "Read more" text.
- string wp_more_text
- int mt_allow_comments
- int mt_allow_pings
- string wp_slug†
- string wp_password†
- string wp_author_id†
- string wp_author_display_name†
- string post_status†
- string wp_post_format† (Added in WordPress 3.1)
- bool sticky† (Added in WordPress 2.7.1)
- array custom_fields† (Added in WordPress 2.3.2)
- struct
- string id
- string key
- string value
- struct
- struct enclosure: Only set if post has an enclosure. (Added in WordPress 2.6.3)
- string url
- int length
- string type
Errors
- 401
- If the user does not have permission to edit this post.
- 404
- If no post with that postid exists.
metaWeblog.getRecentPosts
Retrieve a list of recent posts.
Parameters
- int blogid: Not applicable for WordPress, can be any value and will be ignored.
- string username
- string password
- int numberOfPosts: Optional.
Return Values
- array
- struct: see #metaWeblog.getPost for fields. enclosure will not be included. Note that the returned postid is string instead of an integer.
Errors
- If a user cannot edit a post that would be included in the result set, it will be omitted from the response. Therefore, the total number of posts returned may be less than the requested quantity.
metaWeblog.newPost
Create a new post.
Parameters
- int blogid: Not applicable for WordPress, can be any value and will be ignored.
- string username
- string password
- struct content
- string title
- string description: Post content.
- string post_type: "post" or "page"
- datetime dateCreated†
- datetime date_created_gmt†: If specified, takes precedence over dateCreated.
- array categories: Names of categories assigned to the post.
- array mt_keywords: Names of tags assigned to the post.
- string mt_excerpt
- string mt_text_more: Post "Read more" text.
- string mt_allow_comments: "open" or "closed"
- string mt_allow_pings: "open" or "closed"
- string wp_slug†
- string wp_password†
- string wp_author_id†
- string wp_author_display_name†
- string post_status†
- string wp_post_format† (Added in WordPress 3.1)
- bool sticky† (Added in WordPress 2.7.1)
- array custom_fields† (Added in WordPress 2.3.2)
- struct
- string id: Optional.
- string key
- string value
- struct
- struct enclosure: Only set if post has an enclosure. (Added in WordPress 2.6.3)
- string url
- int length
- string type
- bool publish: Whether to publish the post upon creation or leave it as a draft.
Return Values
- string postid
Errors
- 401
- If user does not have permission to edit or publish posts of the specified type.
- If user does not have permission to edit other users' posts but wp_author_id is specified.
- 404
- If invalid post format is specified.
metaWeblog.editPost
Edit an existing post.
Parameters
- int postid
- string username
- string password
- struct content: See #metaWeblog.newPost for fields.
- bool publish
Return Values
- bool true
Errors
- 401
- If user does not have permission to edit this post.
- If user does not have permission to edit other users' posts but wp_author_id is specified.
- 404
- If no post with that postid exists.
- If invalid post format is specified.
metaWeblog.deletePost
Delete an existing post. Equivalent to blogger.deletePost.
Parameters
- string appkey: Not applicable for WordPress, can be any value and will be ignored.
- int postid
- string username
- string password
- bool publish: Will be ignored.
Return Values
- bool true
Errors
- 401
- If the user does not have permission to delete this post.
- 404
- If no post with that postid exists.
metaWeblog.getCategories
Retrieve list of categories.
Parameters
- int blogid
- string username
- string password
Return Values
- array
- struct
- string categoryId
- string parentId
- string categoryName
- string categoryDescription
- string description: Name of the category, equivalent to categoryName.
- string htmlUrl
- string rssUrl
- struct
Errors
- 401
- If the user does not have the edit_posts cap.
metaWeblog.newMediaObject
Upload a media file.
Parameters
- int blogid
- string username
- string password
- struct data
- string name: Filename.
- string type: File MIME type.
- string bits: base64-encoded binary data.
- bool overwrite: Optional. Overwrite an existing attachment of the same name. (Added in WordPress 2.2)
Return Values
- struct
- string id (Added in WordPress 3.4)
- string file: Filename.
- string url
- string type
Errors
- 401
- If the user does not have the upload_files cap.
- 500
- File upload failure.
metaWeblog.getUsersBlogs
Returns information about all the blogs a given user is a member of. Equivalent to blogger.getUsersBlogs.
Parameters
- string appkey: Not applicable for WordPress, can be any value and will be ignored.
- string username
- string password
Return Values
- array
- struct
- string blogid
- string url: Homepage URL for this blog.
- string blogName
- bool isAdmin†
- string xmlrpc†: URL endpoint to use for XML-RPC requests on this blog.
- struct
metaWeblog.getTemplate
Not supported. Please use the theme editor to manage your templates.
metaWeblog.setTemplate
Not supported. Please use the theme editor to manage your templates.