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

I'm creating a new website based on a theme using custom post type and WordPress 3.2.1.

The problem is that my content was previously using %postname% permalinks and all my SEO is build on this. Using CPT add a slug like : http://mysite.com/slug-cpt/postname

I tried this rule in the register_post_type function but it doesn't work :

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

I also read this but it's not good for me : Permalinks in Custom Post types

Any idea ?

share|improve this question

This is a tricky one, I had exactly the same problem but after a lot of debugging and troubleshooting I managed to fix it.

The trick is to add a new rewrite rule:

function book_rewrite_rule() {
    add_rewrite_rule( '(.*?)$', 'index.php?book=$matches[1]', 'top' );
add_action( 'after_theme_setup', 'book_rewrite_rule' );
share|improve this answer
your sites down :( – BenRacicot Jun 15 '14 at 21:38

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.