Make WordPress Core


Ignore:
Timestamp:
10/01/2020 05:53:38 PM (4 years ago)
Author:
helen
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/media.php

    r49050 r49084  
    23892389
    23902390    /**
     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    /**
    23912400     * @ticket 37813
    23922401     */
Note: See TracChangeset for help on using the changeset viewer.