Title: $arg array use with WP_Query()
Last modified: August 31, 2016

---

# $arg array use with WP_Query()

 *  [olliew](https://wordpress.org/support/users/olliew/)
 * (@olliew)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/arg-array-use-with-wp_query/)
 * I have been using WP_Query() in a simple manner such as
    `$myquery= new WP_Query('
   tag=dogs' );`
 * I see a more complicated use of WP_Query using an array. Why is an array needed
   and under what circumstances should I use an array rather than the simpler method?

Viewing 1 replies (of 1 total)

 *  [stephencottontail](https://wordpress.org/support/users/stephencottontail/)
 * (@stephencottontail)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/arg-array-use-with-wp_query/#post-7309148)
 * I think your specific example is perfectly readable, but IMO, arrays are easier
   to read when you’re passing a large number of arguments to `WP_Query`:
 *     ```
       $args = array(
         'foo'  => 'bar',
         'baz'  => false,
         'qux'  => 4,
         'blah' => 'blah blah'
       );
   
       $query = new WP_Query( $args );
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘$arg array use with WP_Query()’ is closed to new replies.

## Tags

 * [array](https://wordpress.org/support/topic-tag/array/)
 * [loop](https://wordpress.org/support/topic-tag/loop/)
 * [wp_query](https://wordpress.org/support/topic-tag/wp_query/)

 * 1 reply
 * 2 participants
 * Last reply from: [stephencottontail](https://wordpress.org/support/users/stephencottontail/)
 * Last activity: [10 years, 1 month ago](https://wordpress.org/support/topic/arg-array-use-with-wp_query/#post-7309148)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
