WordPress.org

Ready to get started?Download WordPress

Forums

Custom taxonomy add button jumps (7 posts)

  1. hereswhatidid
    Member
    Posted 2 years ago #

    When trying to click the "Add New Equipment Type" button for my custom taxonomy, it simply moves the DOM element up into the list of entries and fails to add the actual term. Here is my taxonomy code:

    $labels = array(
        'name' => _x( 'Equipment Types', 'taxonomy general name' ),
        'singular_name' => _x( 'Equipment Type', 'taxonomy singular name' ),
        'search_items' =>  __( 'Search Equipment Types' ),
        'all_items' => __( 'All Equipment Types' ),
        'parent_item' => __( 'Parent Equipment Type' ),
        'parent_item_colon' => __( 'Parent Equipment Type:' ),
        'edit_item' => __( 'Edit Equipment Type' ),
        'update_item' => __( 'Update Equipment Type' ),
        'add_new_item' => __( 'Add New Equipment Type' ),
        'new_item_name' => __( 'New Equipment Type Name' ),
        'menu_name' => __( 'Equipment Type' ),
      );
    
      register_taxonomy('equipmenttype',array('powerequipment'), array(
        'hierarchical' => true,
        'labels' => $labels,
        'show_ui' => true,
        'query_var' => true,
        'rewrite' => array( 'slug' => 'power-equipment' ),
      ));

    Here's a screenshot of the behavior:

    http://i.stack.imgur.com/UVa2V.png

  2. sangfroidweb
    Member
    Posted 2 years ago #

    Hey, hereswhatidid. Did you ever get this figured out? I'm having the exact problem If you did figure it out and can share the solution I would be very grateful!

  3. hereswhatidid
    Member
    Posted 2 years ago #

    Haven't gotten any responses yet both here and on the WordPress stack exchange. Appears to not be a very widespread problem but it's nice knowing I'm not he only one.

  4. sangfroidweb
    Member
    Posted 2 years ago #

    Bummer... Well I've got to get it figured out.. so if I do.. I'll post what my issue was here. Keep your fingers crossed!

  5. sangfroidweb
    Member
    Posted 2 years ago #

    Hey, I think you posted on another forum.. I saw your post there.. and someone posted an answer that worked for them and it worked for me as well. It appears some code is using some sort of "like" comparison. If your taxonomies are named with a prefix like the name of the post type they are in .. this seems to happen. I went through and renamed my taxonomies without the post type prefix.. and viola.. all is well!

    For example your taxonomy is named 'equipmenttype' .. is the post type the taxonomy used for called 'equipment' perhaps? If so.. I bet that's what's causing it. Anyway.. it was for me. Everything works as it should now. Hopefully this works for you as well... Good luck!

  6. hereswhatidid
    Member
    Posted 1 year ago #

    This solves the issue. Turns out that having a custom taxonomy that begins with the same characters as a custom post type it will break the admin interface for that taxonomy on the Edit Post page.

    Changing the custom taxonomy name from 'equipmenttype' to 'powequipmenttype' fixed it.

    Bug?

  7. johnrork
    Member
    Posted 1 year ago #

    I just ran into this as well, but not with a taxonomy with the same name as the post type. The post type for me is "videos", but the taxonomy was, again, "equipment".

    Has "equipment" become a reserved word, intentionally or otherwise?

Topic Closed

This topic has been closed to new replies.

About this Topic