3

何らかの理由で、分類用語ページへのリンクをクリックすると、ワードプレスはインデックス ファイルを表示し続け、ページが見つからないと表示します。カスタム分類法「寄稿者」の用語とそのページへのリンクを表示するテンプレートを使用して、スラッグ「寄稿者」を含むページがあるため、リンクをクリックするとエラーが発生します。


これはfunctions.php分類法を追加するための私のコードです:

register_taxonomy(
    'contributor',
    'post',
    array(
        'hierarchical' => true,
        'labels' => array( 
             'name' => _x( 'Contributors', 'taxonomy general name' ), 
             'singular_name' => _x( 'Contributor', 'taxonomy singular name' ), 
             'search_items' => __( 'Search Contributors' ), 
             'all_items' => __( 'All Contributors' ), 
             'parent_item' => __( 'Parent Contributor' ), 
             'parent_item_colon' => __( 'Parent Contributor:' ), 
             'edit_item' => __( 'Edit Contributor' ), 
             'update_item' => __( 'Update Contributor' ), 
             'add_new_item' => __( 'Add New Contributor' ), 
             'new_item_name' => __( 'New Contributor Name' ), 
             'menu_name' => __( 'Contributors' ), 
         ),
        'show_tagcloud' => true
    )
);

taxonomy-contributor.phpというファイルを含めてもエラーが発生する理由を知っている人はいますか?

4

2 に答える 2

8

それを機能させるには、書き換えをフラッシュする必要があるようです

add_action('init', 'custom_taxonomy_flush_rewrite');
function custom_taxonomy_flush_rewrite() {
    global $wp_rewrite;
    $wp_rewrite->flush_rules();
}
于 2012-08-13T11:01:07.960 に答える