Last Updated:

How to Remove the Post Type (CPT) Slug From Custom Post Type Permalink

Kalee Raisor
Kalee Raisor Wordpress

Head on over to the support forum for the popular Custom Post Type Permalinks plugin and you are going to see an extremely consistent question posted by many users.

Plugin is great. But is there any option to disable the by default sitename/post-type-name

I tried giving false value to with_front and has_archive, but by default /post-type-name/ comes in slug.

Let's break it down a bit. You're obviously using a custom post type with WordPress and want to remove the post type slug.

Some things to keep in mind:

  • with_front affects the "Common Settings" in the Permalinks page. For example if you are using the date based permalink structure and set with_front to false, this means the date slugs will not be prepended to URL.
  • Custom Post Types show the CPT slug by default as set when the CPT was registered. For example if your custom post type is news, then any posts would be example.com/news/post-name

What a lot of users want to do is either:

  1. Have the CPT posts start at root.
    E.g. example.com/post-name instead of example.com/news/post-name
  2. Include a taxonomy without the CPT slug.
    E.g. example.com/category-name/post-name instead of example.com/news/post-name

Previously this was a complex issue with no official support. If you've been searching for an answer on Google you've probably seen answers like this one that's years old and may or may not work or cause other issues.

Thankfully there is now a simple solution in place thanks to KubiQ who created a plugin that as of recently is compatible with the Custom Post Type Permalinks plugin.

How to remove slug from custom post type post URLs

To remove the slug from the CPT slug what you need to do is:

  1. Install the Custom Post Type Permalinks plugin and the Remove CPT base plugin
  2. Set your CPT permalinks on the Permalinks settings page
  3. Go to Settings > Remove CPT base and check the boxed for the post types you want to remove the CPT slug from

Thanks to the compatibility that KubiQ built into the Remove CPT base plugin to work with the Custom Post Type Permalinks plugin this should be all you need to do. We've tested it out on some of our sites and it's working as expected!