[wp-testers] bug get_posts and custom post type

Michael E. Hancock justmichaelh at gmail.com
Tue May 25 17:27:46 UTC 2010


----- Original Message ----- 
From: "Philip M. Hofer (Frumph)" <philip at frumph.net>
> Not working on the index/home page, works fine on sub pages.
>> $args = array('post__not_in' => array($current_post_id), 'showposts' => 
>> 5, 'orderby' => 'rand', 'post_type' => 'casts');
>> $randomcasts = &get_posts($args);
>>
>> post__not_in  is not being utilized with post_type as being able to 
>> exclude the specified post type, per the codex reference


This works in the index.php of a child theme of the Twenty Ten theme as of 
3.0-beta2-14860

$args=array(
  'post__not_in'=> array(143),
  'post_type' => 'book',
  'post_status' => 'publish',
  'posts_per_page' => -1,
  'caller_get_posts'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);

MichaelH



More information about the wp-testers mailing list