WordPress.org

Ready to get started?Download WordPress

Forums

how to use custom taxonomies in query_posts (3 posts)

  1. sonill
    Member
    Posted 3 years ago #

    can anyone please provide me the easiest way to use the custom taxonomies in query_posts.

    i created custom taxonomies like this:

    register_taxonomy( 'products-categories', 'post',
    						  	array( 'hierarchical' => true, 'label' => 'Product Categories', 'query_var' => true, 'rewrite' => true )
    						  );

    hoping for easy solution, thanks

  2. borantula
    Member
    Posted 3 years ago #

    <?php $myproducts=array(
              'post_type'=>'post',
              'product-categories' => 'bubblegums'
      ); ?>
    
    <?php query_posts($myproducts); ?>
    //and the loop comes next
  3. sonill
    Member
    Posted 3 years ago #

    thank you for help borantula but the above code does not work.
    It fetched every thing, even those posts which are of other categories.

    Is there any working code sample please.

Topic Closed

This topic has been closed to new replies.

About this Topic