1

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.

1 Answer 1

2

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.

3
  • Yup that did it. Now the bigger question is why did it work before (3.0.X) and why didn't it work now? Mar 2, 2011 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. Mar 2, 2011 at 4:47
  • @curtismchale - BTW, see core.trac.wordpress.org/ticket/16649 Mar 2, 2011 at 6:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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