Allow actual DB fields in WP_User_Query orderby. props duck, see #15816.
git-svn-id: https://develop.svn.wordpress.org/trunk@16953 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
26e0e1ab6f
commit
598bb9952a
@ -352,7 +352,7 @@ function update_meta_cache($meta_type, $object_ids) {
|
|||||||
return $cache;
|
return $cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Given a meta query, generates SQL clauses to be appended to a main query
|
* Given a meta query, generates SQL clauses to be appended to a main query
|
||||||
*
|
*
|
||||||
* @since 3.1.0
|
* @since 3.1.0
|
||||||
|
@ -412,6 +412,8 @@ class WP_User_Query {
|
|||||||
// sorting
|
// sorting
|
||||||
if ( in_array( $qv['orderby'], array('email', 'url', 'registered') ) ) {
|
if ( in_array( $qv['orderby'], array('email', 'url', 'registered') ) ) {
|
||||||
$orderby = 'user_' . $qv['orderby'];
|
$orderby = 'user_' . $qv['orderby'];
|
||||||
|
} elseif ( in_array( $qv['orderby'], array('user_email', 'user_url', 'user_registered') ) ) {
|
||||||
|
$orderby = $qv['orderby'];
|
||||||
} elseif ( 'name' == $qv['orderby'] || 'display_name' == $qv['orderby'] ) {
|
} elseif ( 'name' == $qv['orderby'] || 'display_name' == $qv['orderby'] ) {
|
||||||
$orderby = 'display_name';
|
$orderby = 'display_name';
|
||||||
} elseif ( 'post_count' == $qv['orderby'] ) {
|
} elseif ( 'post_count' == $qv['orderby'] ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user