Change Custom Post Type slug in WordPress. The register_post_type_args
filter can be used to modify post type arguments:
1 2 3 4 5 6 7 8 9 10 | function wpse247328_register_post_type_args( $args, $post_type ) { if ( 'portfolio' === $post_type ) { $args['rewrite']['slug'] = 'stories'; } return $args; } add_filter( 'register_post_type_args', 'wpse247328_register_post_type_args', 10, 2 ); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.