Changeset 49084
- Timestamp:
- 10/01/2020 05:53:38 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r49041 r49084 5993 5993 $attachment_id = (int) $attachment_id; 5994 5994 5995 $post = get_post( $attachment_id ); 5996 if ( ! $post ) { 5995 $data = get_post_meta( $attachment_id, '_wp_attachment_metadata', true ); 5996 5997 if ( empty( $data ) ) { 5997 5998 return false; 5998 5999 } 5999 6000 $data = get_post_meta( $post->ID, '_wp_attachment_metadata', true );6001 6000 6002 6001 if ( $unfiltered ) { … … 6013 6012 * @param int $attachment_id Attachment post ID. 6014 6013 */ 6015 return apply_filters( 'wp_get_attachment_metadata', $data, $ post->ID);6014 return apply_filters( 'wp_get_attachment_metadata', $data, $attachment_id ); 6016 6015 } 6017 6016 -
trunk/tests/phpunit/tests/media.php
r49050 r49084 2389 2389 2390 2390 /** 2391 * @ticket 50679 2392 */ 2393 function test_wp_get_attachment_metadata_should_return_false_if_no_attachment() { 2394 $post_id = self::factory()->post->create(); 2395 $data = wp_get_attachment_metadata( $post_id ); 2396 $this->assertFalse( $data ); 2397 } 2398 2399 /** 2391 2400 * @ticket 37813 2392 2401 */
Note: See TracChangeset
for help on using the changeset viewer.