Title: error with wp_query when retrieving custom post types
Last modified: August 20, 2016

---

# error with wp_query when retrieving custom post types

 *  [cw6365](https://wordpress.org/support/users/cw6365/)
 * (@cw6365)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/error-with-wp_query-when-retrieving-custom-post-types/)
 * Hi All,
 * i’ve built a custom query loop to retrieve posts from a custom post type, i also
   only want to retrieve a few specified posts by id
 * `$films = new WP_Query('post_type=films', array('post__in'=>$arrayOfNumbs));`
 * if i leave the post_type out so it defaults to posts and add the films to the
   posts section of wordpress this works fine but when i add the films to the custom
   films post type and add the post_type parameter the loop ignores the post__in
   array (which is previously correctly echo’d out) it ignores this parameter and
   returns all of the films?
 * any help with this is much appreciated

Viewing 1 replies (of 1 total)

 *  Thread Starter [cw6365](https://wordpress.org/support/users/cw6365/)
 * (@cw6365)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/error-with-wp_query-when-retrieving-custom-post-types/#post-2251582)
 * never mind i’ve got it,
 *     ```
       $args=array(
               'post_type'=>'films',
               'post__in'=>$arrayOfNumbs
           );
   
        $films = new WP_Query($args);
       ```
   
 * having a blond moment

Viewing 1 replies (of 1 total)

The topic ‘error with wp_query when retrieving custom post types’ is closed to new
replies.

## Tags

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

 * 1 reply
 * 1 participant
 * Last reply from: [cw6365](https://wordpress.org/support/users/cw6365/)
 * Last activity: [14 years, 9 months ago](https://wordpress.org/support/topic/error-with-wp_query-when-retrieving-custom-post-types/#post-2251582)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
