[wp-trac] [WordPress Trac] #39643: WP_User_Query does not allow search_fields to use display_name
WordPress Trac
noreply at wordpress.org
Sat Jan 21 05:14:40 UTC 2017
#39643: WP_User_Query does not allow search_fields to use display_name
----------------------------------------+--------------------
Reporter: bcole808 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.8
Component: Users | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch needs-unit-tests | Focuses:
----------------------------------------+--------------------
Changes (by SergeyBiryukov):
* component: Query => Users
* milestone: Awaiting Review => 4.8
Comment:
Confirmed. `display_name` was added to the list of default columns to
search in [32980], but was not included in the whitelist, so it's
impossible to search only by `display_name` at the moment.
[attachment:39643.1.diff] looks good, let's also add a unit test if
possible.
Note: The snippet from ticket description doesn't work as is and causes a
PHP warning:
{{{
Warning: array_intersect(): Argument #1 is not an array in wp-includes
/class-wp-user-query.php on line 526
}}}
`search_columns` should be an array, not a string:
{{{
new WP_User_Query( array(
'search' => '*Ben*',
'search_columns' => array( 'display_name' ),
) );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39643#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list