WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#32019 closed defect (bug) (fixed)

WP_User_Query: since 4.2 using array( 'who' => 'authors' ) has no effect on users query

Reported by: imath Owned by: boonebgorges
Milestone: 4.2 Priority: normal
Severity: normal Version: 4.2
Component: Users Keywords: has-patch commit
Focuses: Cc:

Description

This can be annoying i think. When editing a post, the dropdown in the authors metabox is now listing all users.

Applying the quick patch i've attached to this ticket seems to fix the issue.

Attachments (2)

32019.patch (1.4 KB) - added by imath 5 years ago.
32019.2.patch (3.3 KB) - added by boonebgorges 5 years ago.

Download all attachments as: .zip

Change History (9)

@imath
5 years ago

#1 @SergeyBiryukov
5 years ago

  • Milestone changed from Awaiting Review to 4.2

Confirmed. Introduced in [31669].

#2 @boonebgorges
5 years ago

  • Owner set to boonebgorges
  • Status changed from new to reviewing

I'm working on tests.

#3 @boonebgorges
5 years ago

  • Keywords has-patch commit added

32019.2.patch includes imath's suggested fix, plus unit tests demonstrating the issue. Ready for a review.

Last edited 5 years ago by boonebgorges (previous) (diff)

This ticket was mentioned in Slack in #core by gunny123. View the logs.


5 years ago

This ticket was mentioned in Slack in #core by boone. View the logs.


5 years ago

#6 @boonebgorges
5 years ago

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

In 32207:

Ensure that 'who' param is respected when generating meta_query in WP_User_Query.

Since [31669], the 'who' param had been parsed after meta_query was generated,
so that 'who' was effectively ignored.

Props imath.
Fixes #32019.

#7 @boonebgorges
4 years ago

In 37359:

Tests: Correct 'meta_query' syntax in test related to WP_User_Query 'who' param.

The test, introduced in [32207], used the incorrect syntax for 'meta_query' -
one fewer level of array-nesting than what WP_Meta_Query requires. This
slip uncovered a bug introduced into WP_User_Query in [30094], whereby
an incorrectly formatted 'meta_query' parameter would be properly parsed by
WP_User_Query when passed alongside who=authors.

We need to fix the inconsistent syntax in order to resolve #36724.

See #36724, #32019, #23849, #27026.

Note: See TracTickets for help on using tickets.