Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#13805 closed defect (bug) (fixed)

Custom Taxonomy: Wrong Labels Wordpress 3

Reported by: barrycarlyon's profile barrycarlyon Owned by: nacin's profile nacin
Milestone: 3.0 Priority: normal
Severity: normal Version: 3.0
Component: Taxonomy Keywords:
Focuses: Cc:

Description (last modified by nacin)

In Wordpress 3, when I specify a a custom non hierarchy taxonomy (like tags) the wrong labels are used. Works with with a hierarchy based one:

function bugpress_taxonomy() {
	$labels = array(
		'name' => _x( 'Assigned to', 'taxonomy general name' ),
		'singular_name' => _x( 'Assigned to', 'taxonomy singular name' ),
		'search_items' =>	__( 'Search Assignees' ),
		'popular_items' => __( 'Popular Assignees' ),
		'all_items' => __( 'All Assignees' ),
		'parent_item' => null,
		'parent_item_colon' => null,
		'edit_item' => __( 'Edit Assignees' ), 
		'update_item' => __( 'Update Assignees' ),
		'add_new_item' => __( 'Add New Assignee' ),
		'new_item_name' => __( 'New Assignee Name' ),

		'hierarchical' => false,
		'labels' => $labels,
		'show_ui' => true,
		'query_var' => true,
		'rewrite' => array( 'slug' => 'assigned_to' ),

Attachments (1)

Add New Ticket ‹ BugPress — WordPress.jpg (14.5 KB) - added by barrycarlyon 14 years ago.

Download all attachments as: .zip

Change History (13)

#1 @barrycarlyon
14 years ago


hierarchial is TRUE correct labels are used.
when FALSE wrong labels as screenshot shows

Just to clarify

#2 @barrycarlyon
14 years ago

Also this is on Last Nights nightly build (8th June)

#3 @westi
14 years ago

It looks like register_taxonomy and maybe register_posttype expect you to pass in the labels in an array in the safe format as it is in get_taxonomy_labels and get_post_type_labels.

So your labels need to be in an array and in the correct position to get used.

#4 @westi
14 years ago

Scratch that. The bug is elsewhere.

#5 @westi
14 years ago

It's a bug in your registration code.

You need this:

                'hierarchical' => false,
                'labels' => $labels,
                'show_ui' => true,
                'query_var' => true,
                'rewrite' => array( 'slug' => 'assigned_to' ),
        	'helps' => __('Separate assignees with commas.'),
        	'help_hint' => __('Add new assignee'),
        	'help_nojs' => __('Add or remove assignees'),
        	'help_cloud' => __('Choose from the most frequent assignees'),

#6 @westi
14 years ago

  • Keywords reporter-feedback added; wordpress3 taxonomy labels removed

We could do with documenting the help* args in register_taxonomy that post_tags_meta_box uses.

Fancy creating a patch for that ;-)

#7 @nacin
14 years ago

  • Description modified (diff)

The help* args should have become labels for non-hierarchical taxonomies I think.

#8 @ryan
14 years ago

(In [15183]) Pass taxonomy to post_tags_meta_box. Use add_new_item label. see #13805

#9 @ryan
14 years ago

I updated it to use add_new_item for the hint. The others should move to proper labels, as nacin noted. While I was in there I changed post_tags_meta_box() to accept a taxonomy arg like we do with the categories box.

#10 @barrycarlyon
14 years ago

I'm using a custom UI (add_meta_box) anyway, but since I came across it and the fact that the helps is missing from the docs, thought I would report it :-)

#11 @nacin
14 years ago

  • Keywords reporter-feedback removed
  • Owner set to nacin
  • Status changed from new to accepted

#12 @nacin
14 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [15190]) Move 'helps' argument to the taxonomy labels object. Also move over help_nojs and help_cloud, both introduced in 3.0. This adds three new core labels for non-hierarchical taxonomies, for tweaking the meta box strings. fixes #13805.

Note: See TracTickets for help on using tickets.