[wp-trac] [WordPress Trac] #52196: wp_get_attachment_metadata() is broken if no first argument is passed in.

WordPress Trac noreply at wordpress.org
Thu Dec 31 00:16:51 UTC 2020


#52196: wp_get_attachment_metadata() is broken if no first argument is passed in.
--------------------------+-----------------------------
 Reporter:  cfinke        |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:  5.6
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 In r49084 (for #50679), `wp_get_attachment_metadata()` was changed to
 improve performance, but it had the side effect of eliminating the ability
 to call it with no arguments and have it default to using the global
 `$post`.

 It should be possible to keep the performance improvements for all cases
 where an attachment ID is passed in by only calling `get_post()` when
 `$attachment_id` is `0`. I'll upload a patch shortly.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/52196>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list