WordPress.org

Ready to get started?Download WordPress

Forums

Am I doing something wrong, or is this a bug? (3 posts)

  1. Morgan Kay
    Member
    Posted 2 years ago #

    I'm working on a site that has a couple of custom post types with custom taxonomies. One of them is working just fine with no problems. The other one is acting a bit buggy.

    The custom post type is "video", and it has normal post tags plus a hierarchical custom taxonomy called "videogenre." The custom taxonomy works just fine, except that in the menu, it is listed as "Post tags", so the menu looks like this:
    Videos
    --Videos
    --Add New
    --Post Tags
    --Post Tags

    You can see a screenshot here:
    http://alchemycs.com/~morgan/posttags.jpg

    Here's my code:

    add_action( 'init', 'register_taxonomy_videogenre' );
        function register_taxonomy_videogenre() {
        $labels = array(
        'name' => _x( 'Video Genres', 'taxonomy general name' ),
        'singular_name' => _x( 'Video Genre', 'taxonomy singular name' ),
        'search_items' =>  __( 'Search Video Genres' ),
        'all_items' => __( 'All Video Genres' ),
        'parent_item' => __( 'Parent Video Genre' ),
        'parent_item_colon' => __( 'Video Genre Type:' ),
        'edit_item' => __( 'Edit Video Genre' ),
        'update_item' => __( 'Update Video Genre' ),
        'add_new_item' => __( 'Add New Video Genre' ),
        'new_item_name' => __( 'New Video Genre Name' ),
        'menu_name' => __( 'Video Genre' ),
        );
        $args = array(
        'labels' => $labels,
        'public' => true,
        'show_in_nav_menus' => true,
        'show_ui' => true,
        'show_tagcloud' => false,
        'hierarchical' => true,
        'update_count_callback' => 'videogenre_update',
        'rewrite' => true,
        'query_var' => true,
        );
        register_taxonomy( 'videogenre', array('video', $args) );
        }
    
        add_action( 'init', 'register_cpt_videos' );
        function register_cpt_videos() {
        $labels = array(
        'name' => _x( 'Videos', 'video' ),
        'singular_name' => _x( 'Video', 'video' ),
        'add_new' => _x( 'Add New', 'video' ),
        'add_new_item' => _x( 'Add Video', 'video' ),
        'edit_item' => _x( 'Edit Video', 'video' ),
        'new_item' => _x( 'New Video', 'video' ),
        'view_item' => _x( 'View Video', 'video' ),
        'search_items' => _x( 'Search Videos', 'video' ),
        'not_found' => _x( 'No videos found', 'video' ),
        'not_found_in_trash' => _x( 'No videos found in Trash', 'video' ),
        'parent_item_colon' => _x( 'Parent Video:', 'video' ),
        'menu_name' => _x( 'Videos', 'video' ),
        );
        $args = array(
        'labels' => $labels,
        'hierarchical' => true,
        'description' => 'Video and audio',
        'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'trackbacks', 'custom-fields', 'comments', 'post-formats' ),
        'taxonomies' => array( 'post_tag', 'videogenre' ),
        'public' => true,
        'show_ui' => true,
        'show_in_menu' => true,
        'menu_position' => 10,
        'show_in_nav_menus' => true,
        'publicly_queryable' => true,
        'exclude_from_search' => false,
        'has_archive' => true,
        'query_var' => true,
        'can_export' => true,
        'rewrite' => true,
        'capability_type' => 'post'
        );
        register_post_type( 'video', $args );
        }

    Do you see any reason why the custom taxonomy has the wrong name in the dashboard? Other than how it appears in the dashboard, everything works just fine: the URLs are correct (.../videogenre/tutorials) and it uses the right template (taxonomy-videogenre.php).

    So either I'm doing something really stupid here, or there's a bug.

    Thanks for your help!

  2. Joseph
    Member
    Posted 2 years ago #

    You've misplaced the closing bracket:

    register_taxonomy( 'videogenre', array('video', $args) );

    should be

    register_taxonomy( 'videogenre', array('video'), $args );
  3. Morgan Kay
    Member
    Posted 2 years ago #

    I was afraid it was something really stupid like that. :P

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic