小编use*_*866的帖子

Wordpress自定义帖子类型 - 相同的帖子名称,不同的帖子类型

我有4种自定义帖子类型:

服务常见问题解答价格之前和之后

我希望能够在每个帖子类型中使用相同的帖子名称,例如:

服务
皮肤(example.com/Services/skin)Cream(example.com/Services/cream)
正文
(example.com/Services/body)

常见问题
皮肤(example.com/FAQs/skin)Cream(example.com/FAQs/cream)
正文
(example.com/FAQs/body)

价格
皮肤(example.com/Prices/skin)
霜(example.com/Prices/cream)
正文(example.com/Prices/body)


皮肤之前和之后(example.com/before-and-after/skin)

(example.com/before-and-after/cream)Body(example.com/before-and-after/body)

我怎样才能做到这一点?现在,如果我创建一个与当前名称相同的新帖子,它会在帖子slug的末尾添加"-2"或"-3":

坏:

example.com/services/body

example.com/faqs/body-2

example.com/prices/body-3

example.com/before-and-after/body-4

有人请帮助!!!!!

add_action('init', 'create_post_type_html5'); // Add our HTML5 Blank Custom Post Type
function create_post_type_html5()
 {
  register_taxonomy_for_object_type('category', 'html5-blank'); // Register Taxonomies for Category
register_taxonomy_for_object_type('post_tag', 'html5-blank');
register_post_type('html5-blank', // Register Custom Post Type
    array(
    'labels' => array(
        'name' => __('Services', 'html5blank'), // Rename these to suit
        'singular_name' => __('Services', 'html5blank'),
        'add_new' => __('Add New', 'html5blank'),
        'add_new_item' => __('Add New Services', …
Run Code Online (Sandbox Code Playgroud)

wordpress

2
推荐指数
1
解决办法
3278
查看次数

标签 统计

wordpress ×1