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

For a custom post type page I'd like to completely remove the slug so that the URL structure mirrors http://my-domain.com/CPT-title/ or http://my-domain.com/CPT-category/CPT-title . If I set the rewrite parameter to

'rewrite' => array('slug' => '', 'with_front' => false)

Wordpress freaks out and I get 404 on all pages except for the CPT page. If I don't define slug at all, then it defaults to the CPT name.

share|improve this question
up vote 2 down vote accepted

You have to set 'slug' to false and not a blank string.

share|improve this answer
I had tried the same code and had a problem, you're saying to set 'slug' to false so is this right or wrong 'rewrite' => array('slug'=>false,'with_front'=>false), this doesn't work for me the slug's still being generated. What should the code be? Thanks – Anagio Dec 22 '12 at 19:12
Setting the slug to false (and refreshing permalinks) seems to create a redirect for me to the full URL WITH the CPT-name/page-name – BenRacicot Jun 15 '14 at 21:48

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.