2 replaced http://wordpress.stackexchange.com/ with https://wordpress.stackexchange.com/
source | link

To sort by meta fields you need to use meta_key and meta_value (or meta_value_num):

array(
    'meta_key' => 'sort_order', //This is the custom field to orderby
    'orderby' => 'meta_value_num', //for numerical values
    'role'     => 'Administrator', 
    'fields' => 'all_with_meta',
);

However... This will probably order the results before your merge... so,

instead of separate queries you can use meta_query to get multiple roles: (http://wordpress.stackexchange.com/questions/39315/get-multiple-roles-with-get-usersGet multiple roles with get_users)

(This is untested)

global $wpdb;
$blog_id = get_current_blog_id();

$user_query = new WP_User_Query( array(

 'meta_query' => array(
      'relation' => 'OR',
      array(
        'key' => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities',
        'value' => 'author',
        'compare' => 'like'
      ),
      array(
        'key' => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities',
        'value' => 'editor',
        'compare' => 'like'
      )
    )
  //Then add the rest of the query

     'meta_key' => 'sort_order', //This is the custom field to orderby
     'orderby' => 'meta_value_num', //for numerical values
    //'fields' => 'all_with_meta', //which fields to return

) );

To sort by meta fields you need to use meta_key and meta_value (or meta_value_num):

array(
    'meta_key' => 'sort_order', //This is the custom field to orderby
    'orderby' => 'meta_value_num', //for numerical values
    'role'     => 'Administrator', 
    'fields' => 'all_with_meta',
);

However... This will probably order the results before your merge... so,

instead of separate queries you can use meta_query to get multiple roles: (http://wordpress.stackexchange.com/questions/39315/get-multiple-roles-with-get-users)

(This is untested)

global $wpdb;
$blog_id = get_current_blog_id();

$user_query = new WP_User_Query( array(

 'meta_query' => array(
      'relation' => 'OR',
      array(
        'key' => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities',
        'value' => 'author',
        'compare' => 'like'
      ),
      array(
        'key' => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities',
        'value' => 'editor',
        'compare' => 'like'
      )
    )
  //Then add the rest of the query

     'meta_key' => 'sort_order', //This is the custom field to orderby
     'orderby' => 'meta_value_num', //for numerical values
    //'fields' => 'all_with_meta', //which fields to return

) );

To sort by meta fields you need to use meta_key and meta_value (or meta_value_num):

array(
    'meta_key' => 'sort_order', //This is the custom field to orderby
    'orderby' => 'meta_value_num', //for numerical values
    'role'     => 'Administrator', 
    'fields' => 'all_with_meta',
);

However... This will probably order the results before your merge... so,

instead of separate queries you can use meta_query to get multiple roles: (Get multiple roles with get_users)

(This is untested)

global $wpdb;
$blog_id = get_current_blog_id();

$user_query = new WP_User_Query( array(

 'meta_query' => array(
      'relation' => 'OR',
      array(
        'key' => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities',
        'value' => 'author',
        'compare' => 'like'
      ),
      array(
        'key' => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities',
        'value' => 'editor',
        'compare' => 'like'
      )
    )
  //Then add the rest of the query

     'meta_key' => 'sort_order', //This is the custom field to orderby
     'orderby' => 'meta_value_num', //for numerical values
    //'fields' => 'all_with_meta', //which fields to return

) );
1
source | link

To sort by meta fields you need to use meta_key and meta_value (or meta_value_num):

array(
    'meta_key' => 'sort_order', //This is the custom field to orderby
    'orderby' => 'meta_value_num', //for numerical values
    'role'     => 'Administrator', 
    'fields' => 'all_with_meta',
);

However... This will probably order the results before your merge... so,

instead of separate queries you can use meta_query to get multiple roles: (http://wordpress.stackexchange.com/questions/39315/get-multiple-roles-with-get-users)

(This is untested)

global $wpdb;
$blog_id = get_current_blog_id();

$user_query = new WP_User_Query( array(

 'meta_query' => array(
      'relation' => 'OR',
      array(
        'key' => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities',
        'value' => 'author',
        'compare' => 'like'
      ),
      array(
        'key' => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities',
        'value' => 'editor',
        'compare' => 'like'
      )
    )
  //Then add the rest of the query

     'meta_key' => 'sort_order', //This is the custom field to orderby
     'orderby' => 'meta_value_num', //for numerical values
    //'fields' => 'all_with_meta', //which fields to return

) );