Custom taxonomy labels won't display

admin2025-05-31  0

I created two custom taxonomies (Majors and Seminar Types) related my custom post type CEMB Seminar and the labels on the menu, instead of showing the labels I put in are showing "Post Tags".

See a screenshot here (I don't have enough reputation to post pics yet): ;authkey=Gv1sRgCNeKmKmS2J_ccQ&feat=directlink

Here's the code I used to create the custom taxonomies:

// Register the Majors taxonomy
register_taxonomy( 'cemb_seminar_major', array( 'cemb_seminar' ), $major_args );

// Register the Seminar Types taxonomy
register_taxonomy( 'cemb_seminar_type', array( 'cemb_seminar' ), $types_args );

// Set up the Majors arguments
$major_args = array( 
    'rewrite' => array(
        'slug' => 'major',
        'with_front' => 'false'
    ),
    'labels' => array(
        'name' => 'Majors',
        'singular_name' => 'Major'
    )       
);

// Set up the Types arguments
$types_args = array( 
    'rewrite' => array(
        'slug' => 'seminar-type',
        'with_front' => 'false'
    ),
    'labels' => array(
        'name' => 'Seminar Types',
        'singular_name' => 'Seminar Type'
    )
);

I thought maybe since I didn't include all the labels, it wasn't creating the labels correctly, so I later added:

'labels' => array(
            'name' => _x( 'Majors', 'taxonomy general name' ),
            'singular_name' => _x( 'Major', 'taxonomy singular name' ),
            'search_items' => __( 'Search Majors' ),
            'popular_items' => __( 'Popular Majors' ),
            'all_items' => __( 'All Majors' ),
            'edit_item' => __( 'Edit Major' ),
            'update_item' => __( 'Update Major' ),
            'add_new_item' => __( 'Add New Major' ),
            'new_item_name' => __( 'New Major' ),
            'separate_items_with_commas' => __( 'Separate majors with commas' ),
            'add_or_remove_items' => __( 'Add or remove majors' ),
            'choose_from_most_used' => __( 'Choose from the most popular majors' )
        )

and

'labels' => array(
            'name' => _x( 'Seminar Types', 'taxonomy general name' ),
            'singular_name' => _x( 'Seminar Type', 'taxonomy singular name' ),
            'search_items' => __( 'Search Seminar Types' ),
            'popular_items' => __( 'Popular Seminar Types' ),
            'all_items' => __( 'All Seminar Types' ),
            'edit_item' => __( 'Edit Seminar Type' ),
            'update_item' => __( 'Update Seminar Type' ),
            'add_new_item' => __( 'Add New Seminar Type' ),
            'new_item_name' => __( 'New Seminar Type' ),
            'separate_items_with_commas' => __( 'Separate seminar types with commas' ),
            'add_or_remove_items' => __( 'Add or remove seminar types' ),
            'choose_from_most_used' => __( 'Choose from the most popular seminar types' )
        )

But neither changed helped. I noticed my custom post type also didn't have all the labels customized, so I added the labels to that code and the menu changed to reflect the newly added labels, but the custom taxonomies won't do that. What did I do wrong and how do I fix it?

I created two custom taxonomies (Majors and Seminar Types) related my custom post type CEMB Seminar and the labels on the menu, instead of showing the labels I put in are showing "Post Tags".

See a screenshot here (I don't have enough reputation to post pics yet): https://picasaweb.google/112518288555484095597/WordPressIssues?authuser=0&authkey=Gv1sRgCNeKmKmS2J_ccQ&feat=directlink

Here's the code I used to create the custom taxonomies:

// Register the Majors taxonomy
register_taxonomy( 'cemb_seminar_major', array( 'cemb_seminar' ), $major_args );

// Register the Seminar Types taxonomy
register_taxonomy( 'cemb_seminar_type', array( 'cemb_seminar' ), $types_args );

// Set up the Majors arguments
$major_args = array( 
    'rewrite' => array(
        'slug' => 'major',
        'with_front' => 'false'
    ),
    'labels' => array(
        'name' => 'Majors',
        'singular_name' => 'Major'
    )       
);

// Set up the Types arguments
$types_args = array( 
    'rewrite' => array(
        'slug' => 'seminar-type',
        'with_front' => 'false'
    ),
    'labels' => array(
        'name' => 'Seminar Types',
        'singular_name' => 'Seminar Type'
    )
);

I thought maybe since I didn't include all the labels, it wasn't creating the labels correctly, so I later added:

'labels' => array(
            'name' => _x( 'Majors', 'taxonomy general name' ),
            'singular_name' => _x( 'Major', 'taxonomy singular name' ),
            'search_items' => __( 'Search Majors' ),
            'popular_items' => __( 'Popular Majors' ),
            'all_items' => __( 'All Majors' ),
            'edit_item' => __( 'Edit Major' ),
            'update_item' => __( 'Update Major' ),
            'add_new_item' => __( 'Add New Major' ),
            'new_item_name' => __( 'New Major' ),
            'separate_items_with_commas' => __( 'Separate majors with commas' ),
            'add_or_remove_items' => __( 'Add or remove majors' ),
            'choose_from_most_used' => __( 'Choose from the most popular majors' )
        )

and

'labels' => array(
            'name' => _x( 'Seminar Types', 'taxonomy general name' ),
            'singular_name' => _x( 'Seminar Type', 'taxonomy singular name' ),
            'search_items' => __( 'Search Seminar Types' ),
            'popular_items' => __( 'Popular Seminar Types' ),
            'all_items' => __( 'All Seminar Types' ),
            'edit_item' => __( 'Edit Seminar Type' ),
            'update_item' => __( 'Update Seminar Type' ),
            'add_new_item' => __( 'Add New Seminar Type' ),
            'new_item_name' => __( 'New Seminar Type' ),
            'separate_items_with_commas' => __( 'Separate seminar types with commas' ),
            'add_or_remove_items' => __( 'Add or remove seminar types' ),
            'choose_from_most_used' => __( 'Choose from the most popular seminar types' )
        )

But neither changed helped. I noticed my custom post type also didn't have all the labels customized, so I added the labels to that code and the menu changed to reflect the newly added labels, but the custom taxonomies won't do that. What did I do wrong and how do I fix it?

Share Improve this question asked Jul 14, 2011 at 17:33 SlushmanSlushman 493 silver badges13 bronze badges 1
  • Your args need to be defined before registering the taxonomies, that is most definately your issue if the args are being defined after - as in the above code. – t31os Commented Jul 15, 2011 at 8:21
Add a comment  | 

1 Answer 1

Reset to default 1

Try changing 'labels' to an array arg, and passing that. Also, check for syntax:

$labels => array(
    'name' => _x( 'Seminar Types', 'taxonomy general name' ),
    'singular_name' => _x( 'Seminar Type', 'taxonomy singular name' ),
    'search_items' => __( 'Search Seminar Types' ),
    'popular_items' => __( 'Popular Seminar Types' ),
    'all_items' => __( 'All Seminar Types' ),
    'edit_item' => __( 'Edit Seminar Type' ),
    'update_item' => __( 'Update Seminar Type' ),
    'add_new_item' => __( 'Add New Seminar Type' ),
    'new_item_name' => __( 'New Seminar Type' ),
    'separate_items_with_commas' => __( 'Separate seminar types with commas' ),
    'add_or_remove_items' => __( 'Add or remove seminar types' ),
    'choose_from_most_used' => __( 'Choose from the most popular seminar types' )
);
// Set up the Types arguments
$types_args = array( 
    'rewrite' => array(
        'slug' => 'seminar-type',
        'with_front' => 'false'
    ),
    'labels' => $args
);
// Register the Seminar Types taxonomy
register_taxonomy( 'cemb_seminar_type', array( 'cemb_seminar' ), $types_args );
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748635765a313684.html

最新回复(0)