• 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

    (@cw6365)

    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.