If you are using a permalink structure like /blog/%postname% and want to remove /blog/ from a custom post type slug, here’s how to do it.
1. In your functions.php where you created your custom post type, use this code and replace ‘newsletters’ with the slug you want for your custom post type.
1 2 3 4 |
'rewrite' => array( 'slug' => 'newsletters', 'with_front' => false, ) |
The real magic happens with the ‘with_front’ parameter, which, if set to false, removes the base in the permalink custom structure.
2. After you’ve modified your functions.php file, make sure to go to Settings > Permalinks and re-save your settings, otherwise you will probably end up with a 404 page.
For more info on setting up custom post types, please see the Codex.