This code worked well for my child theme. Needed to change “program” slug to “place”.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | /* CHANGE SLUGS OF CUSTOM POST TYPES */ function change_post_types_slug( $args, $post_type ) { /*item post type slug*/ if ( 'program' === $post_type ) { $args['rewrite']['slug'] = 'place'; } return $args; } add_filter( 'register_post_type_args', 'change_post_types_slug', 10, 2 ); /* CHANGE SLUGS OF TAXONOMIES, slugs used for archive pages */ function change_taxonomies_slug( $args, $taxonomy ) { /*item category*/ if ( 'program-category' === $taxonomy ) { $args['rewrite']['slug'] = 'locations'; } return $args; } add_filter( 'register_taxonomy_args', 'change_taxonomies_slug', 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.