我创建了一个自定义分类法,如下所示:
function my_taxonomies_custom() {
$labels = array(
\'name\' => _x( \'Post Categories\', \'taxonomy general name\' ),
\'singular_name\' => _x( \'Post Category\', \'taxonomy singular name\' ),
\'search_items\' => __( \'Search Post Categories\' ),
\'all_items\' => __( \'All Post Categories\' ),
\'parent_item\' => __( \'Parent Post Category\' ),
\'parent_item_colon\' => __( \'Parent Post Category:\' ),
\'edit_item\' => __( \'Edit Post Category\' ),
\'update_item\' => __( \'Update Post Category\' ),
\'add_new_item\' => __( \'Add New Post Category\' ),
\'new_item_name\' => __( \'New Post Category\' ),
\'menu_name\' => __( \'Post Categories\' ),
);
$args = array(
\'labels\' => $labels,
\'hierarchical\' => true,
\'rewrite\' => array(
\'slug\' => \'custom_category\',
\'with_front\' => true,
\'hierarchical\' => true ,
),
);
register_taxonomy( \'custom_category\', \'post_type_slug\', $args );
}
add_action( \'init\', \'my_taxonomies_custom\', 0 );
通过名为
postcat
. 根据我的理解,我现在应该能够
URL http://example.com/custom_category/postcat
这将使用
category.php
page可显示类别中的页面列表。当我转到这个URL时,我得到的只是一个页面,上面写着“找不到。很抱歉,您的请求无法完成。”