Changeset 25628
- Timestamp:
- 09/25/2013 05:33:36 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r25609 r25628 2647 2647 2648 2648 /** 2649 * Insert a post.2649 * Insert or update a post. 2650 2650 * 2651 2651 * If the $postarr parameter has 'ID' set to a value, then post will be updated. … … 2655 2655 * setting the value for 'comment_status' key. 2656 2656 * 2657 * The defaults for the parameter $postarr are: 2658 * 'post_status' - Default is 'draft'. 2659 * 'post_type' - Default is 'post'. 2660 * 'post_author' - Default is current user ID ($user_ID). The ID of the user who added the post. 2661 * 'ping_status' - Default is the value in 'default_ping_status' option. 2662 * Whether the attachment can accept pings. 2663 * 'post_parent' - Default is 0. Set this for the post it belongs to, if any. 2664 * 'menu_order' - Default is 0. The order it is displayed. 2665 * 'to_ping' - Whether to ping. 2666 * 'pinged' - Default is empty string. 2667 * 'post_password' - Default is empty string. The password to access the attachment. 2668 * 'guid' - Global Unique ID for referencing the attachment. 2669 * 'post_content_filtered' - Post content filtered. 2670 * 'post_excerpt' - Post excerpt. 2657 * @global wpdb $wpdb WordPress database abstraction object. 2658 * @global int $user_ID 2671 2659 * 2672 2660 * @since 1.0.0 2673 * @uses $wpdb 2674 * @uses $user_ID 2675 * @uses do_action() Calls 'pre_post_update' on post ID if this is an update. 2676 * @uses do_action() Calls 'edit_post' action on post ID and post data if this is an update. 2677 * @uses do_action() Calls 'save_post_{$post_type}', 'save_post' and 'wp_insert_post' on post id and post data just before returning. 2678 * @uses apply_filters() Calls 'wp_insert_post_data' passing $data, $postarr prior to database update or insert. 2679 * @uses wp_transition_post_status() 2680 * 2681 * @param array $postarr Elements that make up post to insert. 2682 * @param bool $wp_error Optional. Allow return of WP_Error on failure. 2683 * @return int|WP_Error The value 0 or WP_Error on failure. The post ID on success. 2684 */ 2685 function wp_insert_post($postarr, $wp_error = false) { 2661 * 2662 * @param array $postarr { 2663 * An array of elements that make up a post to update or insert. 2664 * 2665 * @type int 'ID' The post ID. If equal to something other than 0, the post with that ID will 2666 * be updated. Default 0. 2667 * @type string 'post_status' The post status. Default 'draft'. 2668 * @type string 'post_type' The post type. Default 'post'. 2669 * @type int 'post_author' The ID of the user who added the post. Default $user_ID, the current user ID. 2670 * @type bool 'ping_status' Whether the post can accept pings. Default value of 'default_ping_status' option. 2671 * @type int 'post_parent' Set this for the post it belongs to, if any. Default 0. 2672 * @type int 'menu_order' The order it is displayed. Default 0. 2673 * @type string 'to_ping' Space or carriage return-separated list of URLs to ping. Default empty string. 2674 * @type string 'pinged' Space or carriage return-separated list of URLs that have been pinged. 2675 * Default empty string. 2676 * @type string 'post_password The password to access the post. Default empty string. 2677 * @type string 'guid' Global Unique ID for referencing the post. 2678 * @type string 'post_content_filtered' The filtered post content. Default empty string. 2679 * @type string 'post_excerpt' The post excerpt. Default empty string. 2680 * } 2681 * @param bool $wp_error Optional. Allow return of WP_Error on failure. 2682 * @return int|WP_Error The post ID on success. The value 0 or WP_Error on failure. 2683 */ 2684 function wp_insert_post( $postarr, $wp_error = false ) { 2686 2685 global $wpdb, $user_ID; 2687 2686
Note: See TracChangeset
for help on using the changeset viewer.