Custom post type permalinks

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%/)

Read More

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.

Related posts

Leave a Reply

3 comments

  1. 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]