Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

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');

I posted on my blog a step by step guide: http://www.ultimatewebtips.com/remove-slug-from-custom-post-type/

Hope that's what you looking for

share|improve this answer
    
your sites down :( –  BenRacicot Jun 15 at 21:38

Your Answer

 
discard

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.