我正在创建自定义帖子类型,它们共享我的博客的类别。我想要的是将类别名称放在永久链接上,并删除自定义文章类型名称。如何将类别置于自定义帖子类型的永久链接上
现在我有:www.mywebsite.com/ 自定义后类型名称 /后名称
而我想要的是:www.mywebsite.com/ 类 /后名称我试图把register_post_type数组''重写'=>数组('slug'=>'%category%'),但它不起作用。结果是www.mywebsite.com/%category%/post-name
先谢谢您! (很遗憾,我的英语)
$labels = array(
'name' => _x('Whitepaper', 'post type general name'),
'singular_name' => _x('Whitepaper', 'post type singular name'),
'add_new' => _x('Add New', 'Whitepaper'),
'add_new_item' => __('Add New Whitepaper'),
'edit_item' => __('Edit Whitepaper'),
'new_item' => __('New Whitepaper'),
'all_items' => __('All Whitepapers'),
'view_item' => __('View Whitepaper'),
'search_items' => __('Search Whitepapers'),
'not_found' => __('No Whitepapers found'),
'not_found_in_trash' => __('No Whitepapers found in Trash'),
'parent_item_colon' => '',
'menu_name' => 'Whitepapers'
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => true,
'menu_position' => null,
'supports' => array('title','editor','author','thumbnail','excerpt','comments','custom-fields'),
'taxonomies' => array('category'),
'rewrite' => array('slug' => '%category%')
);
register_post_type('whitepaper',$args);