I'm trying to find solution for the following hours now and i don't know if this is applicable.

I have 1 Custom Taxonomy "Years" for Post Type "Post (default)". The taxonomy has 2 Terms: "2014" and "2015".

I have select some posts from category "news" to use the 2 different Taxonomy terms.

This shows me all posts for both taxonomy terms :


When I want to display posts from category "news" with taxonomy term "2014" I use the following :


What I'm trying to do is instead of showing all posts from both taxonomy terms in http://website.com/category/news/ to display only "2015" (term) posts without using the slug ?years=2015 and without display "2014" posts

Taxonomy in functions:

function wptp_register_taxonomy() {
    register_taxonomy( 'years', 'post',
            'labels' => array(
                'name'              => 'Years',
                'singular_name'     => 'Year',
                'search_items'      => 'Search Year',
                'all_items'         => 'All Years',
                'edit_item'         => 'Edit Year',
                'update_item'       => 'Update',
                'add_new_item'      => 'Add New Year',
                'new_item_name'     => 'New Year',
                'menu_name'         => 'Years',
            'hierarchical' => true,
            'sort' => true,
            'args' => array( 'orderby' => 'term_order' ),
            'rewrite' => array( 'slug' => 'years' ),
            'show_admin_column' => true
add_action( 'init', 'wptp_register_taxonomy' );

Tried this in the category.php but didn't worked:

$args = array(
    'post_type'=> 'post',
    'years'    => '2015',

$the_query = new WP_Query( $args );
if($the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post()

Thank you

1 Answer 1


It is because you're using a reserved term "year".


  • 1
    Please explain what happens when you are using this term.
    – fuxia
    Jul 20, 2016 at 20:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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