Every time I create a custom post type on a website, I’m always thinking “crap, I hope I don’t have to modify the base URL at all.”
By default, the permalink for any new post type you create will follow this structure:
yoursite.com/cpt-name/post-name
For example, if you create a custom newsletter post type (like I did for The Lab Report), the default post URL is:
yoursite.com/newsletter/issue-1
There are many cases where you might want to remove that base slug though.
You might just want a cleaner URL structure, or you might want to remove it for better SEO.
If you used the CPTUI plugin to create your custom post type, you can technically remove it by setting “With Front: False” and “Custom Rewrite Slug: /”.
This gives the illusion that everything is working great, but once you start navigating around your site, you’ll start wondering where the heck all these 404 errors are coming from.
I’ve spent hours trying to figure it out, but I recently started using a free plugin called “Remove CPT Base” and it’s worked like magic.
Yeah, I know, it seems unnecessary to install another plugin for what seems like a simple task.
But it’s simple, lightweight, and has saved me from a lot of headache.
Worth checking out if you want to remove the CPT base slug from your URL structure!