-1

How can I remove the slug from url.

I could make this one;

www.example.com/tour/boat

www.example.com/boat

I couldnt work this;

www.example.com/en/tour/boat-to is

www.example.com/en/boat-to is

usually all methods not working on multi lang site.

Christian Gollhardt
  • 16,510
  • 17
  • 74
  • 111

1 Answers1

0

When you register the custom post type, you have to specify that the rewrite rule shouldn't be prepended with the existing URL structure.

In short, this means that this line in your register_post_type call:

'rewrite' => array('slug' => 'tour'),

should turn into this:

'rewrite' => array('slug' => 'tour','with_front' => false),

For more info, check out the rewrite argument from the codex entry on register_post_type

Just make sure that, after updating the code, you flush the rewrite rules by visiting Settings > Permalinks. Otherwise you'll still see the old links.

Paul
  • 380
  • 1
  • 10
  • In this case, try to use theses plugins : https://wordpress.org/plugins/custom-permalinks/ and https://fr.wordpress.org/plugins/permalinks-customizer/ – Paul Oct 10 '17 at 07:51