Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I recently found out that I could use the with-front=>false argument in register_post_type(). So I went and changed my custom post type slugs and did a flush_rewrite_rules(). Now 2 of my custom post types are using the desired URLs and 2 are not. The only difference between the 2 that work and the others, is that they also have custom taxonomies. Here is the code from my functions.php file. Any idea what I'm doing wrong?

add_action('init','ASH_addtaxonomies');
add_action('init','ASH_addposttypes');

function ASH_addtaxonomies(){
    register_taxonomy('ash_weave_structure', null,
                      array('labels'=>array('name'=>'Weave Structures',
                                            'singular_name'=>'Structure'),
                            'public'=>true,
                            'hierarchical'=>true,
                            'rewrite'=>array('slug'=>'samples_weaving/structures', 'with-front'=>false),
                            'query_var'=>true
                      )
    );
    register_taxonomy('ash_weave_technique', null,
                    array(  'labels'=>array(    'name'=>'Weaving Techniques',
                                                'singular_name'=>'Technique'),
                            'public'=>true,
                            'hierarchical'=>false,
                            'rewrite'=>array('slug'=>'samples_weaving/techniques', 'with-front'=>false),
                            'query_var'=>true
                    )
    );  
    register_taxonomy('ash_equip_cats', 'ash_equipment',
                    array(  'labels'=>array(    'name'=>'Equipment Categories',
                                                'singular_name'=>'Equipment Category'),
                            'public'=>true,
                            'hierarchical'=>true,
                            'show_ui'=>true,
                            'show_in_nav_menus'=>true,
                            'rewrite'=>array('slug'=>'equipment/category', 'with_front'=>false),
                            'query_var'=>true
                    )
    );
}

function ASH_addposttypes(){

    //good archive url: http://example.com/samples_weaving/
    register_post_type('ash_weaving',
                        array(
                          'description' => 'Picture, draft and technical details of a weaving sample',
                          'public' => true,
                          'show_ui' => true,
                          'show_in_menu' => true,
                          'menu_position'=>5,
                          'rewrite'=>array('slug'=>'samples_weaving', 'with_front'=>false),
                          'query_var' => true,
                          'taxonomies'=>array('post_tag','ash_weave_structure','ash_weave_technique'),
                          'has_archive'=>true,
                          'supports' => array(  'title',
                                                'editor',
                                                'excerpt',
                                                'comments',
                                                'revisions',
                                                'thumbnail',
                                                'author',
                                                'page-attributes'),
                          'labels' => array ( 'name'=>__('Weaving Samples'),
                                              'singular_name'=>__('Weaving Sample')
                                              )
                        )
                    );
    //bad archive url: http://example.com/archives/samples_spinning/
    register_post_type('ash_spinning',
                        array(
                          'description' => 'Picture and technical details of a spinning sample',
                          'public' => true,
                          'show_ui' => true,
                          'show_in_menu' => true,
                          'menu_position'=>5,
                          'rewrite'=>array('slug'=>'samples_spinning', 'with-front'=>false),
                          'query_var' => true,
                          'taxonomies'=>array('post_tag'),
                          'has_archive'=>true,
                          'supports' => array(  'title',
                                                'editor',
                                                'excerpt',
                                                'comments',
                                                'revisions',
                                                'thumbnail',
                                                'author',
                                                'page-attributes'),
                          'labels' => array ( 'name'=>__('Spinning Samples'),
                                              'singular_name'=>__('Spinning Sample')
                                              )
                    )
    );

    //bad archive url: http://example.com/archives/samples_dyeing/  
    register_post_type('ash_dyeing',
                        array(
                          'description' => 'Picture and technical details of a dyeing sample',
                          'public' => true,
                          'show_ui' => true,
                          'show_in_menu' => true,
                          'menu_position'=>5,
                          'rewrite'=>array('slug'=>'samples_dyeing','with-front'=>false),
                          'query_var' => true,
                          'taxonomies'=>array('post_tag'),
                          'has_archive'=>true,
                          'supports' => array(  'title',
                                                'editor',
                                                'excerpt',
                                                'comments',
                                                'revisions',
                                                'thumbnail',
                                                'author',
                                                'page-attributes'),
                          'labels' => array ( 'name'=>__('Dyeing Samples'),
                                              'singular_name'=>__('Dyeing Sample')
                                              )
                        )
    );

    //good archive url: http://example.com/equipment/
register_post_type('ash_equipment',
                        array(
                          'description' => 'Weaving and spinning equipment that ASH makes available to members',
                          'public' => true,
                          'show_ui' => true,
                          'show_in_menu' => true,
                          'menu_position'=>5,
                          'rewrite'=>array('slug'=>'equipment','with_front'=>false),
                          'query_var' => true,
                          'taxonomies'=>array('post_tag','ash_equip_cats'),
                          'has_archive'=>true,
                          'supports' => array(  'title',
                                                'excerpt',
                                                'thumbnail',
                                                'page-attributes'),
                          'labels' => array ( 'name'=>__('Equipment'),
                                              'singular_name'=>__('Equipment')
                                              )
                        )
        );
}
share|improve this question
1  
In your registers, it's with_front, you're using with-front in some of them. –  Shane Feb 7 '12 at 19:01
    
@Shane: Argh! Thank you so much. Why I couldn't see that I don't know. –  dnagirl Feb 7 '12 at 19:07
    
Wasn't sure if that was the fix, i'll post it as an answer as to clear the question from the unanswered list. –  Shane Feb 7 '12 at 19:16
add comment

1 Answer 1

up vote 1 down vote accepted

The problem is in the register functions, in rewrite, you have to change with-front to with_front.

share|improve this answer
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.