#7188 closed defect (bug) (invalid)
wp_get_attachment_metadata doesn't check cache
Reported by: | fshowalter | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description
wp_get_attachment_metadata always makes a database call for post information, even when one isn't necessary. The lines:
$post_id = (int) $post_id; if (!$post =& get_post( $post_id ) ) return false;
Could, and probably should, be changed to:
global $post; $post_id = (int) $post_id; if (empty($post) && !$post =& get_post( $post_id ) ) return false;
For sites with many attachments per post, this could be significant gain.
Change History (2)
Note: See
TracTickets for help on using
tickets.
Realized I was wrong just as I hit submit.