newPost

http://codex.wordpress.org/XML-RPC_WordPress_API wp.newPost (目录好像很多只是3.0) Create a new post of any registered post type. Added in WordPress 3.4. Parameters int blog_id string username string password struct content string post_type string post_status string post_title int post_author string post_excerpt string post_content datetime post_date_gmt | post_date string post_format string post_password string comment_status string ping_status bool sticky int post_thumbnail int post_parent array custom_fields struct string key string value struct terms: Taxonomy names as keys, array of term IDs as values. struct terms_names: Taxonomy names as keys, array of term names as values. struct enclosure string url int length string type any other fields supported by wp_insert_post Return Values string post_id Errors 401 If the user does not have the edit_posts cap for this post type. If user does not have permission to create post of the specified post_status. If post_author is different than the user's ID and the user does not have the edit_others_posts cap for this post type. If sticky=true and user does not have permission to make the post sticky. If a taxonomy in terms or terms_names is not supported by this post type. If terms or terms_names is set but user does not have assign_terms cap. If an ambiguous term name is used in terms_names. 403 If invalid post_type is specified. If an invalid term ID is specified in terms. 404 If no author with that post_author ID exists. If no attachment with that post_thumbnail ID exists. eg: $post = array( 'ID' => [ ] //Are you updating an existing post? 'menu_order' => [ ] //If new post is a page, sets the order should it appear in the tabs. 'comment_status' => [ 'closed' | 'open' ] // 'closed' means no comments. 'ping_status' => [ 'closed' | 'open' ] // 'closed' means pingbacks or trackbacks turned off 'pinged' => [ ? ] //? 'post_author' => [ ] //The user ID number of the author. 'post_category' => [ array(, <...>) ] //Add some categories. 'post_content' => [ ] //The full text of the post. 'post_date' => [ Y-m-d H:i:s ] //The time post was made. 'post_date_gmt' => [ Y-m-d H:i:s ] //The time post was made, in GMT. 'post_excerpt' => [ ] //For all your post excerpt needs. 'post_name' => [ ] // The name (slug) for your post 'post_parent' => [ ] //Sets the parent of the new post. 'post_password' => [ ? ] //password for post? 'post_status' => [ 'draft' | 'publish' | 'pending'| 'future' | 'private' ] //Set the status of the new post. 'post_title' => [ ] //The title of your post. 'post_type' => [ 'post' | 'page' | 'link' | 'nav_menu_item' | custom post type ] //You may want to insert a regular post, page, link, a menu item or some custom post type 'tags_input' => [ ', , <...>' ] //For tags. 'to_ping' => [ ? ] //? 'tax_input' => [ array( 'taxonomy_name' => array( 'term', 'term2', 'term3' ) ) ] // support for custom taxonomies. );
原文地址:https://www.cnblogs.com/fengidri/p/2757500.html