Get WordPress
Codex tools:Log in
Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!
WordPress supports the metaWeblog XML-RPC API, augmented with additional WordPress-specific functionality (denoted by ?) . This support was added in WordPress 1.5.0.
- 1 metaWeblog.getPost
- 1.1 Parameters
- 1.2 Return Values
- 1.3 Errors
- 2 metaWeblog.getRecentPosts
- 2.1 Parameters
- 2.2 Return Values
- 2.3 Errors
- 3 metaWeblog.newPost
- 3.1 Parameters
- 3.2 Return Values
- 3.3 Errors
- 4 metaWeblog.editPost
- 4.1 Parameters
- 4.2 Return Values
- 4.3 Errors
- 5 metaWeblog.deletePost
- 5.1 Parameters
- 5.2 Return Values
- 5.3 Errors
- 6 metaWeblog.getCategories
- 6.1 Parameters
- 6.2 Return Values
- 6.3 Errors
- 7 metaWeblog.newMediaObject
- 7.1 Parameters
- 7.2 Return Values
- 7.3 Errors
- 8 metaWeblog.getUsersBlogs
- 8.1 Parameters
- 8.2 Return Values
- 9 metaWeblog.getTemplate
- 10 metaWeblog.setTemplate
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.
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.
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.
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.
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.
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.
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.
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
Not supported. Please use the theme editor to manage your templates.
Not supported. Please use the theme editor to manage your templates.
Retrieved from https://codex.wordpress.org/index.php?title=XML-RPC_MetaWeblog_API&oldid=158715Categories:
- Advanced Topics
- WordPress Development
- Feeds
- Home Page
- WordPress Lessons
- Getting Started
- Working with WordPress
- Design and Layout
- Advanced Topics
- Troubleshooting
- Developer Docs
- About WordPress
Codex Resources
- Community portal
- Current events
- Recent changes
- Random page
- Help