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?


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.

  • 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. – IFightCode 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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