Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

This has been bugging me for the best part of a day now, so I'm appealing to help in order to calm my nerves.

I run a site that has many custom post types. Every post type shares the use of the post_tag taxonomy.

I need to create a page that shows all the posts that are tagged with "video". It's not working like I expect. It's only showing the normal blog posts - not the other custom post types that are also tagged with 'video'.

Below is the code that I've got. For reference the function get_bonn_post_types is an array of all the post types on my install.

$args = array(
'post_type' => array(get_bonn_post_types()),
'tax_query' => array(
    array(
        'taxonomy' => 'post_tag',
        'field' => 'slug',
        'terms' => 'video'
    )
));
query_posts($args);

Why isn't this working. Any help is of course much appreciated! :)

share|improve this question
1  
get_bonn_post_types returns an array, and you're inserting that into another array? –  Milo Oct 6 '13 at 14:10
    
Yep - that'll do it! Thanks Milo! This is why I shouldn't code when I'm tired! #SchoolBoyErrors Carry on. –  Fred Bradley Oct 6 '13 at 14:37
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.