Wordpress, WP_Query with custom taxonomy and custom post type
Posted
by Chris
on Stack Overflow
See other posts from Stack Overflow
or by Chris
Published on 2010-04-15T15:54:34Z
Indexed on
2010/04/16
1:23 UTC
Read the original article
Hit count: 747
Wordpress
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 )
);
I can't see how both can work individually but together they don't unless it might be a bug - any thoughts?
© Stack Overflow or respective owner