How can I remove custom post type slug from my base url ? for eg : mywebsiteurl.com/custom-post-slug/postname I would like to make it mywebsiteurl.com/postname instead .

1 Answer 1


I'm not sure why you would want to do this in the first place or need custom post types. Removing the post type name from the URL completely would most likely cause conflicts between posts and pages. One way would be to have your permalinks just /%postname% (change in Settings > Permalinks on the dashboard).

In the code of which you register your custom post type there is a rewrite property which lets you change the slug value from post-type-name/post-name (the post-type-name bit) to something else using 'rewrite' => array('slug' => 'this-is-the-new-slug-value'). If you want to remove the slug, maybe using CPT isn't such a good idea in the first place, as the slugs give the URL's some form of hierarchy and prevent conflicts.

As far as I know, there is no standard out-of-the-box solution to remove it completely, not having a slug wouldn't make any sense, so I don't forsee such functionality being added into the core. Having said that, if you must remove it, this blog post details a solution for removing it. I'm not sure how well it works but appears to work based on what I've seen and will do what you're asking.

Also: Welcome to the site Kuldeep.

  • Thanks alot Dwayne ! The link you posted solved my problem :) Thank you ! Thank you ! Thank you !
    – user15083
    Commented Apr 11, 2012 at 15:11
  • If your problem has been solved, please consider accepting Dwaynes answer ( see under the reputation arrows to the left )
    – Tom J Nowell
    Commented Apr 11, 2012 at 15:22
  • 2
    Problem isn't solved because the answer is in a link, which no longer exists. Commented Oct 6, 2015 at 11:54
  • His "answer" is just saying "why would you even want to do that?" Hardly a helpful answer. There are legit cases where having a post's URL off the root URL is useful.
    – Gavin
    Commented Jul 6, 2017 at 21:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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