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.

Since 3.1 I've had an issue with custom taxonomies for a site. it seems that my user (admin level) can't edit the taxonomies from any screen. I see them on under the custom post type and can see them when adding a new post to the custom post type. I can even add currently available taxonomies to the post but I can't create new terms or access the custom taxonomy on it's edit page. Below is my code to set up the taxonomy.

 <?php add_action( 'init', 'fvww_custom_taxonomies');

function fvww_custom_taxonomies() {

    $labels = array(
        'name'                  => __( 'River Classes', 'taxonomy general name' ),
        'singular_name'         => __( 'River Class', 'taxonomy singular name' ),
        'search_items'          => __( 'Search River Classes' ),
        'all_items'             => __( 'All River Classes' ),
        'parent_item'           => __( 'Parent Class' ),
        'parent_item_colon'     => __( 'Parent Class:' ),
        'edit_item'             => __( 'Edit River Class' ),
        'update_item'           => __( 'Update River Class' ),
        'add_new_item'          => __( 'Add New River Class' ),
        'new_item_name'         => __( 'New River Class' ),
        'menu_name'             => __( 'River Class' ),
    );

    register_taxonomy( 'Class', array( 'fvww-river-guide' ), array(
        'hierarchical'              => true, //operates like a category
        'labels'                    => $labels,
        'rewrite'                   => true,
        'public'                    => true,
        'show_ui'                   => true,
        )
    ); // ends class taxonomy

} /* end function */ ?>

If I click on the 'Class' taxonomy under River Guides I get the 'Cheatin uh?' message from wp-admin/edit-tags.php line 12.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Hi @curtismchale:

Try 'river-class' instead of 'Class', i.e.:

 register_taxonomy( 'river-class', array( 'fvww-river-guide' ), array(
    'hierarchical'              => true, //operates like a category
    'labels'                    => $labels,
    'rewrite'                   => true,
    'public'                    => true,
    'show_ui'                   => true,
    )
); // ends class taxonomy

Actually what caused you to stumble was your choice of a capitalized taxonomy name (i.e. "Class" vs. "class") although I'd really recommend against such a generic name as "class" to avoid potential conflict which is why I suggested "river-class" instead.

share|improve this answer
    
Yup that did it. Now the bigger question is why did it work before (3.0.X) and why didn't it work now? –  curtismchale Mar 2 '11 at 4:30
    
@curtismchale - Line 97 of /wp-admin/admin.php uses sanitize_key($_GET['taxonomy']) which converts to lowercase and 3.0 did not do that. It's probably a regression bug but I hope they leave it in because I think keys like taxonomy names (and post types) should ideally be lower case. –  MikeSchinkel Mar 2 '11 at 4:47
    
thanks and yeah it should stay in –  curtismchale Mar 2 '11 at 4:58
    
@curtismchale - BTW, see core.trac.wordpress.org/ticket/16649 –  MikeSchinkel Mar 2 '11 at 6:48
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.