WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So I've create a custom post type which seem to work.

however the permalinks of the create posts has the name of the custom post type in-front of the post name.

I am getting addresses like: http://demoforhim2.e-ddl.com/movie_reviews/secondone/

and trying to change that to : http://demoforhim2.e-ddl.com/secondone/

From reading some articles e.g http://wordpress.org/support/topic/custom-post-type-permalink-rewrite this is possible

I've tried using rewrite with empty slug but it did not work.

Here is my custom post type

add_action( 'init', 'create_movie_review' );
function create_movie_review() {
register_post_type( 'movie_reviews',
        'labels' => array(
            'name' => 'Movie Reviews',
            'singular_name' => 'Movie Review',
            'add_new' => 'Add New',
            'add_new_item' => 'Add New Movie Review',
            'edit' => 'Edit',
            'edit_item' => 'Edit Movie Review',
            'new_item' => 'New Movie Review',
            'view' => 'View',
            'view_item' => 'View Movie Review',
            'search_items' => 'Search Movie Reviews',
            'not_found' => 'No Movie Reviews found',
            'not_found_in_trash' => 'No Movie Reviews found in Trash',
            'parent' => 'Parent Movie Review'
        'public' => true,
        'menu_position' => 15,
        'supports' => array( 'title', 'editor', 'comments', 'thumbnail' ),
        'taxonomies' => array( '' ),
        'menu_icon' => plugins_url( 'images/16x16.png', __FILE__ ),
        'has_archive' => true,
        'rewrite' => array('slug' => '', 'with_front' => FALSE) /*doesnt seem to work*/

for some reason the above doesn't work properly.

share|improve this question
Frontless permalinks are reserved for the post type page. How should conflicts be resolved? – toscho Jan 6 '13 at 5:11
well by not letting a conflict happen in the first place i think. i mean wp wont let you use the same permalink twice in normal posts there should be a way to do the same with custom post types as well without adding the custom post type infront – Yaniv Kossas Jan 6 '13 at 5:15
Thank you milo i was sure both are possible. thanks for clarifying – Yaniv Kossas Jan 6 '13 at 5:30
@toscho How about when permalinks are set to /%postname%/? – shea Jan 6 '13 at 6:03
Hm, okay wp_unique_post_slug() should prevent collisions. I vaguely remember exceptions for CPTs, but might be wrong. – toscho Jan 6 '13 at 6:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.