简体   繁体   中英

WordPress taxonomy.php not working for custom taxonomy

I have a custom post type "certificates" & I have a custom taxonomy "certificate_category" that registered for "certificates" custom post type. here is my definition of taxonomy:

$args = array(
        'labels' => $labels,
        'hierarchical' => true,
        'show_ui' => true,
        'show_admin_column' => true,
        'query_var' => true,
        'rewrite' =>array( 'slug' => 'topics' )
    );
        register_taxonomy('certificate_category', 'certificates', $args);

This taxonomy has two terms with names "international" & "interior". I have created taxonomy.php for display "certificate_category" taxonomy (international & interior have same template).

The url for "internatonal" term is mysit/topics/international & for "interior" term is mysit.com/topics/interior and they both redirect to index.php.

What should I do to show taxonomy.php ?

You shouldn't have to change any settings in the permalinks section, just visit it, then try opening /topics/international. The template you need is just taxonomy.php. I created a site with such configuration, and it worked on 1st try. Do you have any posts in any of the taxonomy terms?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM