(added post_name) |
Pschrottky (talk | contribs) m (→Parameters: Add the `s` parameter to the filter struct, which is missing here but present in https://developer.wordpress.org/reference/classes/wp_xmlrpc_server/wp_getposts/#parameters) |
||
| (13 intermediate revisions by 5 users not shown) | |||
| Line 7: | Line 7: | ||
=== Parameters === | === Parameters === | ||
| − | |||
* string <tt>username</tt> | * string <tt>username</tt> | ||
* string <tt>password</tt> | * string <tt>password</tt> | ||
| Line 16: | Line 15: | ||
* struct: Note that the exact fields returned depends on the <tt>fields</tt> parameter. | * struct: Note that the exact fields returned depends on the <tt>fields</tt> parameter. | ||
| − | ** string <tt>post_id</tt> | + | ** string <tt> post_id </tt> |
** string <tt>post_title</tt><sup>1</sup> | ** string <tt>post_title</tt><sup>1</sup> | ||
** datetime <tt>post_date</tt><sup>1</sup> | ** datetime <tt>post_date</tt><sup>1</sup> | ||
| Line 52: | Line 51: | ||
<sup>1</sup> <tt>post</tt> meta-field<br> | <sup>1</sup> <tt>post</tt> meta-field<br> | ||
| + | |||
| + | ==== Notes ==== | ||
| + | |||
| + | * In the older metaweblog API, the "Introduction" and the "Read More" content for a post were returned in separate fields "description" and "mt_text_more". In the WordPress API, the two values are combined in the single "post_content" field, separated by the <!--more--> tag. | ||
=== Errors === | === Errors === | ||
| Line 93: | Line 96: | ||
** int <tt>offset</tt> | ** int <tt>offset</tt> | ||
** string <tt>orderby</tt> | ** string <tt>orderby</tt> | ||
| + | ** string <tt>s</tt> | ||
** string <tt>order</tt> | ** string <tt>order</tt> | ||
* array <tt>fields</tt>: Optional. See [[#wp.getPost]]. | * array <tt>fields</tt>: Optional. See [[#wp.getPost]]. | ||
| Line 129: | Line 133: | ||
** datetime <tt>post_date_gmt</tt> | <tt>post_date</tt> | ** datetime <tt>post_date_gmt</tt> | <tt>post_date</tt> | ||
** string <tt>post_format</tt> | ** string <tt>post_format</tt> | ||
| − | ** string <tt>post_name</tt> | + | ** string <tt>post_name</tt>: Encoded URL (slug) |
** string <tt>post_password</tt> | ** string <tt>post_password</tt> | ||
** string <tt>comment_status</tt> | ** string <tt>comment_status</tt> | ||
** string <tt>ping_status</tt> | ** string <tt>ping_status</tt> | ||
| − | ** | + | ** int <tt>sticky</tt> |
** int <tt>post_thumbnail</tt> | ** int <tt>post_thumbnail</tt> | ||
** int <tt>post_parent</tt> | ** int <tt>post_parent</tt> | ||
| Line 158: | Line 162: | ||
** If user does not have permission to create post of the specified <tt>post_status</tt>. | ** If user does not have permission to create post of the specified <tt>post_status</tt>. | ||
** If <tt>post_author</tt> is different than the user's ID and the user does not have the <tt>[[Roles_and_Capabilities#edit_others_posts|edit_others_posts]]</tt> cap for this post type. | ** If <tt>post_author</tt> is different than the user's ID and the user does not have the <tt>[[Roles_and_Capabilities#edit_others_posts|edit_others_posts]]</tt> cap for this post type. | ||
| − | ** If <tt>sticky | + | ** If <tt>sticky</tt> is passed and user does not have permission to make the post sticky, regardless if <tt>sticky</tt> is set to <tt>0</tt>, <tt>1</tt>, <tt>false</tt> or <tt>true</tt>. |
** If a taxonomy in <tt>terms</tt> or <tt>terms_names</tt> is not supported by this post type. | ** If a taxonomy in <tt>terms</tt> or <tt>terms_names</tt> is not supported by this post type. | ||
** If <tt>terms</tt> or <tt>terms_names</tt> is set but user does not have <tt>[[Roles_and_Capabilities#assign_terms|assign_terms]]</tt> cap. | ** If <tt>terms</tt> or <tt>terms_names</tt> is set but user does not have <tt>[[Roles_and_Capabilities#assign_terms|assign_terms]]</tt> cap. | ||
| Line 181: | Line 185: | ||
* string <tt>password</tt> | * string <tt>password</tt> | ||
* int <tt>post_id</tt> | * int <tt>post_id</tt> | ||
| − | * struct <tt>content</tt>: See [[#wp.newPost]] for valid set of fields. Only needs to contain fields that you wish to modify; all other fields will retain their current values. | + | * struct <tt>content</tt>: See [[#wp.newPost]] for valid set of fields. Only needs to contain fields that you wish to modify; all other fields will retain their current values. |
| + | |||
| + | === Notes === | ||
| + | |||
| + | * You must pass the meta ID to update any existing items in the custom_fields array. | ||
=== Return Values === | === Return Values === | ||
| Line 311: | Line 319: | ||
* string <tt>password</tt> | * string <tt>password</tt> | ||
* array <tt>filter</tt>: Optional. | * array <tt>filter</tt>: Optional. | ||
| − | ** bool <tt>show-supported</tt>: | + | ** bool <tt>show-supported</tt>: Retrieve both the complete list of post formats, and the specific list of formats supported by the current theme. |
=== Return Values === | === Return Values === | ||
Retrieve a post of any registered post type.
Added in WordPress 3.4.
1 post meta-field
The default set of fields to be returned can be controlled using the xmlrpc_default_post_fields filter. The default value for this filter is:
array( 'post', 'terms', 'custom_fields' )
Immediately before returning the prepared post data, the value is passed through the xmlrpc_prepare_post filter. The filter has three parameters:
Retrieve list of posts of any registered post type.
Added in WordPress 3.4.
Supports same filters as #wp.getPost.
Create a new post of any registered post type.
Added in WordPress 3.4.
Edit an existing post of any registered post type.
Added in WordPress 3.4.
Can also return same errors as #wp.newPost.
Delete an existing post of any registered post type.
See wp_delete_post for exact behavior based on post type.
Added in WordPress 3.4.
Retrieve a registered post type.
Added in WordPress 3.4.
1 labels meta-field
2 capabilities meta-field.
3 menu meta-field.
4 taxonomies meta-field.
The default set of fields to be returned can be controlled using the xmlrpc_default_posttype_fields filter. The default value for this filter is:
array( 'labels', 'capabilities', 'taxonomies' )
Retrieve list of registered post types.
Added in WordPress 3.4.
The default set of fields to be returned can be controlled using the xmlrpc_default_posttype_fields filter. The default value for this filter is:
array( 'labels', 'capabilities', 'taxonomies' )
Retrieve list of post formats.
Added in WordPress 3.1.
If filter or show-supported is omitted or false:
Example response data:
array( 'standard' => 'Standard', 'aside' => 'Aside', 'image' => 'Image', ... );
If show-supported is set:
Example response data:
array(
'all' => array(
'standard' => 'Standard',
'aside' => 'Aside',
'image' => 'Image',
...
),
'supported' => array( 'standard', 'image' )
);
Retrieve list of supported values for post_status field on posts.
Added in WordPress 2.5.
Example response data:
array( 'draft' => 'Draft', 'pending' => 'Pending Review', 'private' => 'Private', 'publish' => 'Published' );