Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fredbradley/6854567 to your computer and use it in GitHub Desktop.
Save fredbradley/6854567 to your computer and use it in GitHub Desktop.
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…
<?php
/*
Hello!
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! :) */
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment