WordPress.org

Make WordPress Core

Opened 8 months ago

Closed 8 months ago

#25177 closed defect (bug) (fixed)

map_meta_cap() doesn't require $post_author_data

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

Description

map_meta_cap() sets up $post_author_data to check if a user is editing/deleting/reading their own post. However, the only piece of data required is the ID. To get this data we already have $post_author_id from $post->post_author or $user_id.

Related: [21563] for #21120 did some optimisations to avoid get_userdata()

Attachments (1)

25177.diff (1.6 KB) - added by duck_ 8 months ago.

Download all attachments as: .zip

Change History (4)

duck_8 months ago

comment:1 duck_8 months ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 3.7

comment:2 nacin8 months ago

Passes all existing tests.

comment:3 nacin8 months ago

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

In 25177:

Don't set up $post_author_data in map_meta_cap() as we don't need it.

props duck_.
fixes #25177.

Note: See TracTickets for help on using tickets.