#7188 closed defect (bug) (invalid)
wp_get_attachment_metadata doesn't check cache
| Reported by: | fshowalter | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | General | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Realized I was wrong just as I hit submit.