Title: Sort with args from array
Last modified: August 21, 2016

---

# Sort with args from array

 *  [willee](https://wordpress.org/support/users/willee/)
 * (@willee)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/sort-with-args-from-array/)
 * This is my `$args`:
 *     ```
       $args=array(
           'post_status'       => 'publish',
           'post_type'         => 'products',
           'tax_query'         => array(
               array(
                   'taxonomy'  => 'product_categories',
                   'terms'     => explode(',', $groups_separated),
                   'field'     => 'slug',
               )
           ),
           'posts_per_page'	=> 30
       );
       ```
   
 * I would like to sort `$args` by the order of the `terms` that is being passed
   to it in `$groups_separated`
 * Is this possible? If so, how would I go about it?

Viewing 1 replies (of 1 total)

 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/sort-with-args-from-array/#post-4220738)
 * The code in this pastebin might help: [http://pastebin.com/3vwiDSfb](http://pastebin.com/3vwiDSfb)
 * Replace the $id_array with the array from explode(‘,’, $groups_separated).

Viewing 1 replies (of 1 total)

The topic ‘Sort with args from array’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * Last activity: [12 years, 7 months ago](https://wordpress.org/support/topic/sort-with-args-from-array/#post-4220738)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
