【问题标题】:change post to "custom post type" without changing the the URL将帖子更改为“自定义帖子类型”而不更改 URL
【发布时间】:2017-09-05 14:15:41
【问题描述】:

以前有人问过这个问题,但我找不到适合我情况的答案。

我有一些现有的帖子需要更改为新的 CPT 。 当我更改为新的 CPT 时,网址也会更新。我怎样才能防止这种情况?

另外,我确实希望 slug 出现在我将来为 CPT 创建的任何新页面上。

       $args = array(
        'labels'             => $labels,
        'label'              => 'Custom Page',
        'description'        => 'Custom Page',
        'menu_icon'          => 'dashicons-smartphone',
        'public'             => true,
        'publicly_queryable' => true,
        'show_ui'            => true,
        'show_in_menu'       => true,
        'query_var'          => true,
        'rewrite'            => array(
            'slug'       => 'custom',
            'with_front' => false
        ),
        'capability_type'    => 'post',
        'has_archive'        => false,
        'hierarchical'       => true,
        'menu_position'      => 5,
        'supports'           => array( 'title', 'editor', 'excerpt', 'page-attributes'),
    );

    register_post_type( 'custom_page', $args );

【问题讨论】:

    标签: wordpress custom-post-type


    【解决方案1】:

    我使用了一个简洁的插件Post Type Switcher

    这个插件的作用是在几秒钟内将任何帖子类型切换到任何帖子类型,我认为你总是可以使用这个插件并删除这个插件..试试看

    【讨论】:

    • 它改变了帖子的网址
    猜你喜欢
    • 2015-04-02
    • 2012-12-14
    • 2017-03-30
    • 2012-02-16
    • 2016-09-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多