WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 .

share|improve this question

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.

share|improve this answer
Thanks alot Dwayne ! The link you posted solved my problem :) Thank you ! Thank you ! Thank you ! – user15083 Apr 11 '12 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 Apr 11 '12 at 15:22
Problem isn't solved because the answer is in a link, which no longer exists. – JorgeLuisBorges Oct 6 '15 at 11:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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