WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#16503 closed defect (bug) (fixed)

get_post_format() generates queries on unsupported post types

Reported by: nacin Owned by:
Milestone: 3.1 Priority: normal
Severity: normal Version:
Component: Performance Keywords: has-patch commit
Focuses: Cc:

Description

get_post_format() is used in two places in the list table templating, which will cause an unnecessary term fetch query for every post. That's no fun.

I started to fix this by patching the problem instances. But it should itself bail early if the post type isn't supported. Incoming patch does both. Pick and choose.

Attachments (2)

16503.diff (1.8 KB) - added by nacin 4 years ago.
16503.2.diff (441 bytes) - added by nacin 4 years ago.

Download all attachments as: .zip

Change History (6)

@nacin4 years ago

@nacin4 years ago

comment:1 @nacin4 years ago

Going with the get_post_format early return per IRC.

comment:2 @nacin4 years ago

  • Keywords commit added

comment:3 @ryan4 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [17429]) Don't query the post format for post types that don't support formats. Props nacin. fixes #16503 for trunk

comment:4 @ryan4 years ago

(In [17430]) Don't query the post format for post types that don't support formats. Props nacin. fixes #16503 for 3.1

Note: See TracTickets for help on using tickets.