When you add a custom post type, WordPress doesn’t know that it needs to regenerate it’s permalinks/rewrite rules.
Visit the permalinks settings page to flush and regenerate the links and your custom post type permalinks will start to work, else you’ll get 404 messages.
A word of warning: Some people will advise you call flush_rewrite_rules
on the init hook. While this will work, it will also greatly slow down your site, and cause other unpredictable problems.
Changing your post type URLs
This can be done using the rewrite parameter in register_post_type:
http://codex.wordpress.org/Function_Reference/register_post_type#Arguments
rewrite (boolean or array) (optional) Triggers the handling of rewrites for this post type. To prevent rewrites, set to false.
Default: true and use $post_type as slug $args array
- ‘slug’ => string Customize the permastruct slug. Defaults to the $post_type value. Should be translatable.
- ‘with_front’ => bool Should the permastruct be prepended with the front base. (example: if your permalink structure is /blog/, then your
links will be: false->/news/, true->/blog/news/). Defaults to true- ‘feeds’ => bool Should a feed permastruct be built for this post type. Defaults to has_archive value.
- ‘pages’ => bool Should the permastruct provide for pagination. Defaults to true
- ‘ep_mask’ => const As of 3.4 Assign an endpoint mask for this post type. For more info see Trac Ticket 19275 and this Make WordPress
Plugins summary of endpoints.
- If not specified and permalink_epmask is set, inherits fro
permalink_epmask
- If not specified and permalink_epmask is not set, defaults to
EP_PERMALINK
e.g.
'rewrite' => array( 'slug' => 'freetips' ),