1
votes

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

2
I saw this kind of problem solutions in Wordpress Support. There you can search and find something. wordpress.org/support/topic/custom-taxonomy-and-query_posts wordpress.org/support/topic/query-posts-by-tag-and-custom-fieldiBlogger

2 Answers

1
votes

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.

http://wordpress.org/support/topic/query_post-by-meta_key-only-without-specific-category-setting-not-works

1
votes

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