[wp-hackers] query_posts with custom taxonomy and custom post type
    Christian Foster 
    christian.foster at gmail.com
       
    Thu Apr 15 17:09:00 UTC 2010
    
    
  
Hi,
I'm having a bit of trouble getting what I understand should be the
correct functionality out of WP_Query with custom taxonomies and
posts.
This code gets 10 posts of all types that are linked to the term_name;
global $wp_query;
query_posts( array(
    "taxonomy_name" => "term_name",
    'showposts' => 10 )
);
This code gets 10 posts of custom post type "message";
global $wp_query;
query_posts( array(
    'post_type' => 'message'
    'showposts' => 10 )
);
This code however always ignores the post_type requirement but still
selects all post types linked to the term_name;
global $wp_query;
query_posts( array(
    'post_type' => 'message' ,
    "taxonomy_name" => "term_name",
    'showposts' => 10 )
);
    
    
More information about the wp-hackers
mailing list