Title: Loop Query: multiple CPT, sort by 1
Last modified: January 13, 2019

---

# Loop Query: multiple CPT, sort by 1

 *  [twentyfourdegrees](https://wordpress.org/support/users/twentyfourdegrees/)
 * (@twentyfourdegrees)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/loop-query-multiple-cpt-sort-by-1/)
 * Hi all,
 * hope you are all doing fine. My question for you is:
 * I have this query:
 *     ```
                                       $categoryquery_args = array(
                                           'post_type' => array('movie', 'formule', 'post'),
                                           'post_status' => 'publish',
                                           'nopaging' => true,
                                           'order' => 'ASC',
                                           'orderby' => 'type'
                                       )
       ```
   
 * I want to make sure that all movies are displayed first in the search results.
   But there’s no way to say “orderby => ‘movie'”. That doesn’t work.
 * All ideas welcome!
 * kind regards

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

 *  [Joy](https://wordpress.org/support/users/joyously/)
 * (@joyously)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/loop-query-multiple-cpt-sort-by-1/#post-11083834)
 * Reading [https://codex.wordpress.org/Class_Reference/WP_Query](https://codex.wordpress.org/Class_Reference/WP_Query)
   it seems that an easy way would be to name the movie type so it would sort first.
   
   There is also the `relevance` parameter, but it only looks at titles and content.
 *  Thread Starter [twentyfourdegrees](https://wordpress.org/support/users/twentyfourdegrees/)
 * (@twentyfourdegrees)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/loop-query-multiple-cpt-sort-by-1/#post-11083923)
 * Oh thank you [@joyously](https://wordpress.org/support/users/joyously/), I will
   have a try with that one. Maybe it is an easy fix, although it will require some
   scaffolding 😉
 *  [Joy](https://wordpress.org/support/users/joyously/)
 * (@joyously)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/loop-query-multiple-cpt-sort-by-1/#post-11083972)
 * Not sure what you mean, since I was saying to rename the movie post type to something
   like amovie, so it comes out first. The WP_Query reference is just so you can
   see what all the options are for your query.

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

The topic ‘Loop Query: multiple CPT, sort by 1’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 3 replies
 * 2 participants
 * Last reply from: [Joy](https://wordpress.org/support/users/joyously/)
 * Last activity: [7 years, 4 months ago](https://wordpress.org/support/topic/loop-query-multiple-cpt-sort-by-1/#post-11083972)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
