Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#44580 closed enhancement (duplicate)

The function attachment_url_to_postid in wp-includes/media.php causes a slow query for a huge database

Reported by: samvthom16 Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.9.7
Component: Media Keywords:
Focuses: performance Cc:


We have close to 40k posts and equivalent number of items in the media library. Lot of plugins like Yoast Seo use the function attachment_url_to_postid() quite often. This causes a slow query because of the huge database.

Since URLs don't change that often. The function can use transient variables instead of querying the posts table.

Change History (1)

#1 @birgire
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Thanks for your report @samvthom16

This has already been reported in #41281.

Please join in there, thanks.

Note: See TracTickets for help on using tickets.