taxonomy- $ taxonomy.php does not work

0

Good afternoon. I am creating a site with more than one Custom Post Type. For example: Custom Post Type "A" has the taxonomy "Types" (type1 and type2). Custom Post Type "B" has the taxonomy "Years" (2016, 2015 ...).

I created a taxonomy-tipos.php file for Custom Post Type "A". So I can list all items of type1 and type2 separately. This worked.

Then I created a taxonomy-anos.php file to list the items for a given year. But this time it did not work. When I click on a year, wp takes the template index.php and not taxonomy-anos.php .

(I simplified the names to make it easier to understand).

The taxonomy creation code I used is transcribed just below. It is in functions.php file. The file with the template for this taxonomy would be taxonomy-productionyear.php . That's exactly what I did for another Custom Post Type, which has another taxonomy.

add_action('init', 'taxonomy_production_year');
function taxonomy_production_year(){
    $labels = array(
        'name' => _x( 'Publications Years', 'taxonomy general name' ),
        'singular_name'     => _x( 'Publication Year', 'taxonomy singular name' ),
        'search_items'      => __( 'Search for Year' ),
        'all_items'         => __( 'All Years' ),
        'parent_item'       => __( 'Parent Year' ),
        'parent_item_colon' => __( 'Parent Year:' ),
        'edit_item'         => __( 'Edit Year' ),
        'update_item'       => __( 'Update Year' ),
        'add_new_item'      => __( 'Add New Year' ),
        'new_item_name'     => __( 'New Year' ),
        'menu_name'         => __( 'Year' ),
    );
    $args = array(
        'hierarchical'      => false,
        'label'             => __( 'Year' ),
        'labels'            => $labels,
        'show_ui'           => true,
        'show_in_tag_cloud' => true,
        'query_var'         => true,
        'rewrite'           => array(
            'slug'          => 'production/year',
            'with_front'    => false,
        ),
    );
    register_taxonomy( 'productionyear', 'post_type_production', $args );
}
    
asked by anonymous 20.02.2018 / 20:08

1 answer

0

I solved the problem. Went in Settings - > Permanent Links - > Saved changes. So I updated the page and it worked.

    
20.02.2018 / 22:50