WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a custom post type for my videos. I need do related it with other post category. And i have 10 category

Like this :

Post Category - Video Category
Tech            Tech
Marketing       Marketing
News            News

I want to do for this. I have a post Category Tech and I have custom post type Category(Taxonomy) Tech..

When I currently viewing Tech (Post) Category, How can i list (on sidebar) Tech videos?

share|improve this question
Take a look at wordpress.org/extend/plugins/posts-to-posts - it allows for connecting post types and there are shortcodes and functions for listing them accordingly. – Mario Peshev Mar 16 '13 at 19:16
Thanks @MarioPeshev, it is just about Post to Post i need Category(post category) to Category(Custom Post Taxonomy Term). – Genxer Mar 16 '13 at 19:53
up vote 3 down vote accepted

From your question I gather your taxonomy term names match your category names. If this is the case and always will be the case, why not just query your custom post type by category slugs? Not sure what the exact name is, so I just made it video.

// get category slug
$cat = get_category( get_query_var( 'cat' ) );
$cat_slug = $cat->slug;

// query your custom post type (video?), assuming 
// slugs match for your category name and taxonomy term name
$my_args = array(
    'post_type' => 'video',
    'tax_query' => array(
            'taxonomy' => 'your_taxonomy_name',
            'field' => 'slug',
            'terms' => $cat_slug

$my_query = new WP_Query($my_args);

while ($my_query->have_posts()) {
    // do the usual thing
share|improve this answer
It worked perfectly! Thanks @dalbaeb – Genxer Mar 17 '13 at 0:52

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.