Make WordPress Core

Opened 5 years ago

Closed 5 years 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:


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_ 5 years ago.

Download all attachments as: .zip

Change History (4)

5 years ago

#1 @duck_
5 years ago

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

#2 @nacin
5 years ago

Passes all existing tests.

#3 @nacin
5 years 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.