Title: Alternative &#039;orderby&#039; in $args array?
Last modified: August 22, 2016

---

# Alternative 'orderby' in $args array?

 *  [codesniffer](https://wordpress.org/support/users/codesniffer/)
 * (@codesniffer)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/alternative-orderby-in-args-array/)
 * Hello,
    I have a bug in my plugin that I can’t resolve. I need to order results
   by a custom post’s field ‘publisher’:
 * >  global $post;
   >  $args = array( ‘post_type’ => ‘book’, ‘post_status’ => array(‘
   > pending’, ‘draft’ ), ‘posts_per_page’ => 100, ‘order’ => ‘ASC’, ‘orderby’ =
   > > ‘meta_value’, ‘meta_key’ => ‘publisher’ ); query_posts( $args );
 * It is working with one problem – If custom field ‘publisher’ does not exist in
   a post the post is not going to be selected. It will be missing in a result list.
   Even though the post is ‘pending’ or ‘draft’.
 * Is there a way to have alternative order clause in the $args list?
    So if ‘publisher’
   filed is missing for some of the posts, the results would be ordered by some 
   other default field? Thanks!

The topic ‘Alternative 'orderby' in $args array?’ is closed to new replies.

## Tags

 * [orderby](https://wordpress.org/support/topic-tag/orderby/)

 * 0 replies
 * 1 participant
 * Last reply from: [codesniffer](https://wordpress.org/support/users/codesniffer/)
 * Last activity: [11 years, 3 months ago](https://wordpress.org/support/topic/alternative-orderby-in-args-array/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
