我可以重定向而不是重写register_taxonomy

时间:2018-07-17 14:00:17

标签: php wordpress

您好,我现在显示以下自定义分类法:

     $package_category = get_the_term_list( $post->ID, 'package-category', '', ', ' , '' );
        if(!empty($package_category)){
            echo '<div class="package-info">';
            echo '<span class="head">Categories: </span>';
            echo $package_category;
            echo '</div>';
    }   

        register_taxonomy(
        "package-category", array("package"), array(
            "hierarchical" => true,
            "label" => "Package Categories", 
            "singular_label" => "Package Categories", 
            "rewrite" => array(
'slug' => '/')));
    register_taxonomy_for_object_type('package-category', 'package');

当前,此列表列出了一堆带有指向category / package-category /的链接的标签,但是“ rewrite” =>导致问题,因为它实际上覆盖了category /

是否可以重定向到category /而不是重写

1 个答案:

答案 0 :(得分:0)

我相信我找到了答案:

'rewrite' => array( 
'slug'          => '.',
'with_front'    => false 
),

为我工作