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 have a custom post type called "number" and I would like to achieve URL's for it's "posts" to be the following http://website.com/post-name instead of http://website.com/number/post-name.

I tried to set the 'rewrite' parameter in register_post_type to: 'rewrite' => array( 'slug' => '', 'with_front' => false ), but it didn't worked. Even if I saved my permalinks settings to flush it. (I have my permalinks set to Day and name - /%year%/%monthnum%/%day%/%postname%/)

Do you have any ideas how to achieve it? I am doing a transfer of one website to WP and I would like to keep the current URL structure, so it will be safe for Google as well.

Thank you in advance for any tips.

share|improve this question
    
Its advised not to have something before the post name mainly because it messes with how WP handles pages. –  Manny Fleurmond Aug 26 '11 at 15:55

3 Answers 3

up vote 1 down vote accepted

You could use a rewrite rule in your .htaccess file to remove number from the link.

You'll need something along the lines of:

RewriteRule ^number/(.+)$ $1 [R=301,L]
share|improve this answer

Here's a plugin that will help you.

http://plugins.trac.wordpress.org/browser/custom-post-permalinks/tags/1.1.4

Install it, go to Settings > Permalinks and modify the field corresponding to the CPT.

share|improve this answer

do you have update the permalinks after your activation of your code? Alternate you can refresh the permalinks via source in your functions with the WP function flush_rewrite_rules().

You can also read this question and answer from here.

share|improve this answer
    
That will not help the above issue. Custom post type permalinks are set up to display as post-type*/*post-name even with_front set to false. –  Alex Older Aug 30 '11 at 8:19

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.