Support Forum
Hello!
I've set up a Custom Post Type.
By default, the permalink structure is my-site.com/cpt-slug/post-title.
I would like to remove the CPT slug from the URL, so it would be just my-site.com/post-title.
How can I achieve that?
I've been playing with the Custom Rewrite Slug. It's empty by default, so I tried adding a slash /, but it broke the site. I also tried adding /%postname%/, but that wasn't successful either. Any ideas?
Thank you very much!
Hi,
Meta Box does not support removing the CPT slug from the URL. You can use the code to remove post type slug from the permalink. Please follow these topics for more information
https://wordpress.org/support/topic/removing-slug-in-url-from-custom-post-type/
https://stackoverflow.com/questions/41230665/how-to-remove-taxonomy-slug-from-custom-post-type-url
Thank you! 🙂
Just for future reference, what have worked best for me is following these steps:
https://kellenmace.com/remove-custom-post-type-slug-from-permalinks/
Long, why doesn't metabox support removing the CPT slug from the URL? I'm rebuilding a high ranking site that was built with all pages before thus it doesn't have a "slug" before the actual page title. I'd like to refrain from creating a lot of redirects and also potentially risk losing some rankings due to url restructuring.
+1 MetaBox should support removing the CPT slug from the URL!
I can't make the code snippet work, anyone more lucky then me?
Hello Francesco!
You need to add both of these PHP snippets to your site (via functions.php or using a code snippet plugin such as WPCodeBox): https://kellenmace.com/remove-custom-post-type-slug-from-permalinks/
Then, change where it says "race" for the slug of your CPT.
After that, go to Settings > Permalinks and re-save being /%postname%/ your structure.
And it should work! 🙂 I have tested just now in a website I am working on.
Thanks Knut! I will try your solution.
This plugin did the trick for me - https://wordpress.org/plugins/permalink-manager/
But I'm as well thinking Meta Box should have this feature built in.