mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Media: Don't unnecessarily check for a valid attachment before getting meta.
This makes `wp_get_attachment_metadata()` run significantly faster. See ticket for benchmarking. Props Tkama, donmhico. Fixes #50679. git-svn-id: https://develop.svn.wordpress.org/trunk@49084 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -2387,6 +2387,15 @@ EOF;
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 50679
|
||||
*/
|
||||
function test_wp_get_attachment_metadata_should_return_false_if_no_attachment() {
|
||||
$post_id = self::factory()->post->create();
|
||||
$data = wp_get_attachment_metadata( $post_id );
|
||||
$this->assertFalse( $data );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 37813
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user