[wp-trac] [WordPress Trac] #7188: wp_get_attachment_metadata
doesn't check cache
WordPress Trac
wp-trac at lists.automattic.com
Thu Jun 26 18:04:35 GMT 2008
#7188: wp_get_attachment_metadata doesn't check cache
------------------------+---------------------------------------------------
Reporter: fshowalter | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 2.7
Component: General | Version:
Severity: normal | Keywords:
------------------------+---------------------------------------------------
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.
--
Ticket URL: <http://trac.wordpress.org/ticket/7188>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list