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

Is it possible to remove alias from custom post type? Let me tell a bit more. For instance, I've created a post type, name "Book". So URL will be domain.com/book/post-title or domain.com/?post_type=book&p=528. I want the URL as domain.com/post-title.

Is it possible?

share|improve this question
up vote 1 down vote accepted

In short - you cannot, or at least should not.

www.domain.com/post-title is interpreted as post (if your structure is %postname%) and/or a page - and WordPress is set to deal with them as such, including any conflicts.

You can do the following:

function wpse0845_add_rule(){

(and then flush rewrite rules, once).

However, you'll notice that now your pages (and depending on your structure, posts too) give a 404.

share|improve this answer
I was successful using a combination of some tricks. Rewrite rules in functions and htaccess, and some special configuration in 'rewrite' => array( 'slug' => ... Anyway, thanks Stephen for your answer. – Enthusiast May 2 '12 at 13:06
Tanmoy, could you perhaps supply the rest of that solution? – Zach Lysobey Jul 2 '12 at 5:09

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.