Reputation: 319
I need to obtain all the posts that have the same tag. But I have the difficult situation that Ive created a new post type called video (instead of post i create videos)
When I make $args = array( 'numberposts' => 10, 'order'=> 'ASC','post_type' => 'video');
$blablabla = query_posts($args);
I have a result, but when I add the 'tag'=>'whatevertag' I dont receive anything. Do you know why have i got this problem?
Thanks for all
Upvotes: 1
Views: 495
Reputation: 873
Have you think about using instead meta_key or meta_value modify the custom_post to use category? http://codex.wordpress.org/Function_Reference/get_cat_ID
$catId = get_cat_ID($categoryname);
and then in the args of the query insert 'category'=>$catId
Upvotes: 1
Reputation: 3738
That's because you use a custom type and for custom types you use custom tags. You need to use meta_key and meta_value.
Upvotes: 1