Changeset 55019 for trunk/tests/phpunit/includes/abstract-testcase.php
- Timestamp:
- 12/28/2022 02:07:16 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/abstract-testcase.php
r55016 r55019 1523 1523 * 1524 1524 * @since 4.4.0 1525 * @since 6.2.0 Returns a WP_Error object on failure. 1525 1526 * 1526 1527 * @param array $upload Array of information about the uploaded file, provided by wp_upload_bits(). 1527 1528 * @param int $parent_post_id Optional. Parent post ID. 1528 * @return int|WP_Error The attachment ID on success . The value 0 or WP_Erroron failure.1529 * @return int|WP_Error The attachment ID on success, WP_Error object on failure. 1529 1530 */ 1530 1531 public function _make_attachment( $upload, $parent_post_id = 0 ) { … … 1548 1549 ); 1549 1550 1550 $id = wp_insert_attachment( $attachment, $upload['file'], $parent_post_id ); 1551 wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) ); 1552 return $id; 1551 $attachment_id = wp_insert_attachment( $attachment, $upload['file'], $parent_post_id, true ); 1552 1553 if ( is_wp_error( $attachment_id ) ) { 1554 return $attachment_id; 1555 } 1556 1557 wp_update_attachment_metadata( 1558 $attachment_id, 1559 wp_generate_attachment_metadata( $attachment_id, $upload['file'] ) 1560 ); 1561 1562 return $attachment_id; 1553 1563 } 1554 1564
Note: See TracChangeset
for help on using the changeset viewer.