Make WordPress Core

Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#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)

#1 @fshowalter
18 years ago

  • Resolution → invalid
  • Status new → closed

Realized I was wrong just as I hit submit.

#2 @thee17
18 years ago

  • Milestone 2.7
Note: See TracTickets for help on using tickets.