0

I want to change the url structure for custom post type

post type --> movies

This url structure sitename.com/movies/post-name need to change sitename.com/custom-taxonomy/movies/post-name

/%customtaxonomy%/%customposttype%/%postname%/

1
  • Although your structure is the other way round, setting rewrite to %custom_tax%/movies should work just as well
    – kero
    Oct 8, 2018 at 11:27

1 Answer 1

0

I think you have to create your own rewrite rule for that custom post type.

Example creating a rewrite rule :

function custom_rewrite( $wp_rewrite ) {
    $feed_rules = array(
        'reviews/(.+)/(.+)'      =>  'index.php?post_type=movies&taxonomy_name='.$wp_rewrite->preg_index(1).'&post_name=' . $wp_rewrite->preg_index(2)
    );
    $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;
}
// refresh/flush permalinks in the dashboard if this is changed in any way
add_filter( 'generate_rewrite_rules', 'custom_rewrite' );

Not the answer you're looking for? Browse other questions tagged or ask your own question.