Query for getting posts in a custom post type, custom taxonomy?
-
Hi! I’m trying to get all posts in the post type ‘color’, that are tagged with a certain tag in the custom taxonomy, ‘colorname’.
I’ve tried the following queries, and neither work as expected:
$args = array( ‘post_type’ => ‘color’,
‘posts_per_page’ => -1,
‘tax_query’ => array( array (
‘taxonomy’ => ‘colorname’,
‘field’ => ‘slug’,
‘terms’ => $slug
) )
);
$myposts = query_posts( $args );$args = array(‘colorname’ => $page_title,
‘post_type’ => ‘color’,
‘post_status’ => ‘publish’,
‘posts_per_page’ => -1,
‘caller_get_posts’=> 1
);
$myposts = query_posts( $args );What am I missing? Thank you ??
- The topic ‘Query for getting posts in a custom post type, custom taxonomy?’ is closed to new replies.