Ticket #37813: 37813.diff
File 37813.diff, 1.2 KB (added by , 8 years ago) |
---|
-
wp-includes/post.php
4697 4697 * 4698 4698 * @see wp_insert_post() 4699 4699 * 4700 * @param string|array $args Arguments for inserting an attachment. 4701 * @param string $file Optional. Filename. 4702 * @param int $parent Optional. Parent post ID. 4703 * @return int Attachment ID. 4700 * @param string|array $args Arguments for inserting an attachment. 4701 * @param strings $file Optional. Filename. 4702 * @param int $parent Optional. Parent post ID. 4703 * @param bool $wp_error Optional. Whether to allow return of WP_Error on failure. Default false. 4704 * @return int|WP_Error The Attachment ID on success. If set true WP_Error on failure. 4704 4705 */ 4705 function wp_insert_attachment( $args, $file = false, $parent = 0 ) {4706 function wp_insert_attachment( $args, $file = false, $parent = 0, $wp_error = false ) { 4706 4707 $defaults = array( 4707 4708 'file' => $file, 4708 4709 'post_parent' => 0 … … 4716 4717 4717 4718 $data['post_type'] = 'attachment'; 4718 4719 4719 return wp_insert_post( $data );4720 return wp_insert_post( $data, $wp_error ); 4720 4721 } 4721 4722 4722 4723 /**