WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #27887, comment 3


Ignore:
Timestamp:
04/20/2014 06:03:09 AM (6 years ago)
Author:
genkisan
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #27887, comment 3

    initial v1  
    33{{{
    44function my_pre_user_query($query) {
    5         $key = $query->get('meta_key');
    6         if ($key == 'your_key') {
     5        $meta_key = $query->get('meta_key');
     6        $orderby = $query->get('orderby');
     7        if ($meta_key == 'your_key' && $orderby == 'meta_value') {
    78                global $wpdb;
    89                $query->query_orderby = ' ORDER BY ' . $wpdb->usermeta  . '.meta_value+0 ' . $query->get('order');