• Resolved chosendaone

    (@chosendaone)


    I would like to change slug of allready existing CPT, but when i try to change it in options, then CPT just creating new CPT post type.

    Is there anyway to change slug of existing cpt?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter chosendaone

    (@chosendaone)

    function change_post_type_slug() {
        $args = array(
            'rewrite' => array( 'slug' => 'new-slug' ),
            // other post type arguments
        );
        register_post_type( 'your_post_type', $args );
    }
    add_action( 'init', 'change_post_type_slug' );

    will it work? i dont want o break my site or lose cpt TT

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Hi, if you don’t include this checkbox, right below the “post type slug” field when editing an existing post type, it does essentially duplicate the settings. However, if you make sure to check the checkbox, we’ll also migrate all the posts in the post type to the newly renamed post type, and remove the previous one.

    Screen Shot

    Based on what I know about registering post types, the example code in the 2nd one wouldn’t do much at all, especially on the front of renaming anything.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change slug of existing CPT’ is closed to new replies.