I'm creating custom post types that are sharing the categories of my blog. And what I want is to put the category name on the permalink and also delete the custom post type name.
Now I have: www.mywebsite.com/custom-post-type-name/post-name
And what I want is: www.mywebsite.com/category/post-name
I tried to put on the register_post_type array 'rewrite' => array('slug' => '%category%') but it doesn't works. The result was www.mywebsite.com/%category%/post-name
Thank you in advance! (And sorry for my english)
$labels = array(
'name' => _x('Whitepaper', 'post type general name'),
'singular_name' => _x('Whitepaper', 'post type singular name'),
'add_new' => _x('Add New', 'Whitepaper'),
'add_new_item' => __('Add New Whitepaper'),
'edit_item' => __('Edit Whitepaper'),
'new_item' => __('New Whitepaper'),
'all_items' => __('All Whitepapers'),
'view_item' => __('View Whitepaper'),
'search_items' => __('Search Whitepapers'),
'not_found' => __('No Whitepapers found'),
'not_found_in_trash' => __('No Whitepapers found in Trash'),
'parent_item_colon' => '',
'menu_name' => 'Whitepapers'
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => true,
'menu_position' => null,
'supports' => array('title','editor','author','thumbnail','excerpt','comments','custom-fields'),
'taxonomies' => array('category'),
'rewrite' => array('slug' => '%category%')
);
register_post_type('whitepaper',$args);