Title: Multiple loop orderby
Last modified: August 1, 2018

---

# Multiple loop orderby

 *  [duocia](https://wordpress.org/support/users/duocia/)
 * (@duocia)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/multiple-loop-orderby/)
 * Hello, I have these arguments for my WP_Query. And it works perfectly. But What
   I need more from it, is so that I could be able to specific post to the top. 
   For example post with id 128 should be first but also order by custom fields.
 *     ```
       $args = array(
                              'post_type' => $type,
                              'post_status' => 'publish',
                              'posts_per_page' => $ppp,
                              'paged' => 1,
                              'meta_query' => array(array(
                                 'key'		=> 'iki',
                                 'compare'	=> '>=',
                                 'value'		=> $today,
                               )),
                               'orderby' => array(
                               'iki' => 'ASC',
                               ),
                            );
       ```
   
 * Could I add in orderby array additional parameter?
    -  This topic was modified 7 years, 9 months ago by [duocia](https://wordpress.org/support/users/duocia/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [swayam.tejwani](https://wordpress.org/support/users/swayamtejwani/)
 * (@swayamtejwani)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/multiple-loop-orderby/#post-10547665)
 * I think you can set that post as “sticky” in wordpress, that way it will show
   first.
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/multiple-loop-orderby/#post-10548955)
 * Swayam is correct, for the post you want to always be on top, checkmark the stick
   option under Visibility in the Publish meta box of its post edit screen. There’s
   a similar check box in the quick edit dialog.
 * You cannot specify specific ordering of individual posts by using the orderby
   argument, you can only specify certain criteria be used in the ordering, like
   author or title. It is possible to use PHP code to directly manipulate the array
   of posts before they are output, but marking as sticky is far easier and sounds
   like it will meet your needs.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Multiple loop orderby’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 2 replies
 * 3 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [7 years, 9 months ago](https://wordpress.org/support/topic/multiple-loop-orderby/#post-10548955)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
