How To Change Slug Of A Custom Post Type

Share Now

//chnage slug of a custom post type

add_filter( 'register_post_type_args', 'comand_register_post_type_args', 10, 2 );
function comand_register_post_type_args( $args, $post_type ) {

    if ( 'command' === $post_type ) {
        $args['rewrite']['slug'] = 'comand';
    }

    return $args;
}
Nahid Mahamud

Nahid Mahamud

Web Developer | Graphic Designer | WordPress & Woo-commerce Expert