diff --git src/wp-includes/post.php src/wp-includes/post.php
index 905a99a..2776ba2 100644
|
|
function is_local_attachment($url) { |
4694 | 4694 | * setting the value for the 'comment_status' key. |
4695 | 4695 | * |
4696 | 4696 | * @since 2.0.0 |
| 4697 | * @since 4.7.0 Add fourth paramater `$wp_error` to allow return of WP_Error on failure. |
4697 | 4698 | * |
4698 | 4699 | * @see wp_insert_post() |
4699 | 4700 | * |
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. |
| 4701 | * @param string|array $args Arguments for inserting an attachment. |
| 4702 | * @param string $file Optional. Filename. |
| 4703 | * @param int $parent Optional. Parent post ID. |
| 4704 | * @param bool $wp_error Optional. Whether to allow return of WP_Error on failure. Default false. |
| 4705 | * @return int|WP_Error The attachment ID on success. The value 0 or WP_Error on failure. |
4704 | 4706 | */ |
4705 | | function wp_insert_attachment( $args, $file = false, $parent = 0 ) { |
| 4707 | function wp_insert_attachment( $args, $file = false, $parent = 0, $wp_error = false ) { |
4706 | 4708 | $defaults = array( |
4707 | 4709 | 'file' => $file, |
4708 | 4710 | 'post_parent' => 0 |
… |
… |
function wp_insert_attachment( $args, $file = false, $parent = 0 ) { |
4716 | 4718 | |
4717 | 4719 | $data['post_type'] = 'attachment'; |
4718 | 4720 | |
4719 | | return wp_insert_post( $data ); |
| 4721 | return wp_insert_post( $data, $wp_error ); |
4720 | 4722 | } |
4721 | 4723 | |
4722 | 4724 | /** |