custom post slug rewrite
-
sorry if this has been ask many times, but can’t find a workable solution.
how to rewrite a custom slug /careers/ to /candidates/ when its hard coded into the theme without only override function
This is the code i need to change:
if( 'career' == $post_type ){ $slug = get_option('tommusrhodus_careers_slug', 'careers'); $home .= '<li class="active"><a href="' . esc_url( home_url( "/". $slug ."/" ) ) . '">' . esc_html__( 'Careers', 'stack' ) . '</a></li>'; }
I have tried.
function change_post_types_slug( $args, $post_type ) { /*item post type slug*/ if ( 'careers' === $post_type ) { $args['rewrite']['slug'] = 'candidates'; } return $args; } add_filter( 'register_post_type_args', 'change_post_types_slug', 10, 2 );
but this doesn’t work in the child theme functions.php even after resaving the permalinks.
Any ideas?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘custom post slug rewrite’ is closed to new replies.