Make WordPress Core

Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#30586 closed enhancement (fixed)

'not_found' taxonomy label should be used in the list table

Reported by: iammathews's profile iammathews Owned by: wonderboymusic's profile wonderboymusic
Milestone: 4.2 Priority: normal
Severity: normal Version: 2.3
Component: Taxonomy Keywords: has-patch 4.2-early
Focuses: administration Cc:

Description

When registering a new taxonomy, you cannot change the "No items found." label when there are no items for that specific taxonomy.

Attachments (2)

30586.patch (2.0 KB) - added by SergeyBiryukov 10 years ago.
tax-no-items.PNG (30.9 KB) - added by iammathews 10 years ago.
Screenshot of issue.

Download all attachments as: .zip

Change History (9)

#1 @SergeyBiryukov
10 years ago

  • Focuses accessibility removed

There is a 'not_found' argument for taxonomy labels, see #23597 where it was introduced.

#2 @iammathews
10 years ago

As read on the codex - 'not_found' (3.6+) - the text displayed via clicking 'Choose from the most used tags' in the taxonomy meta box when no tags are available. This string is not used on hierarchical taxonomies.

It's as if 'not_found' gets ignored. Here's the code:

add_action( 'init', 'register_programme_types', 0 );
function register_programme_types(){
	$labels = array(
		'name'              => _x( 'Programme Types', '' ),
		'singular_name'     => _x( 'Type', '' ),
		'menu_name'         => __( 'Programme Types' ),
		'all_items'         => __( 'All Types' ),
		'edit_item'         => __( 'Edit Type' ),
		'view_item'         => __( 'View Type' ),
		'update_item'       => __( 'Update Type' ),
		'add_new_item'      => __( 'Add New Type' ),
		'new_item_name'     => __( 'New Type Name' ),
		'parent_item'       => __( 'Parent Type' ),
		'parent_item_colon' => __( 'Parent Type:' ),
		'search_items'      => __( 'Search Types' ),
		'not_found'         => __( 'No types found.' ),
	);

	$args = array(
		'hierarchical'      => true,
		'labels'            => $labels,
		'show_ui'           => true,
		'show_admin_column' => true,
		'query_var'         => true,
		'rewrite'           => array( 'slug' => 'types' ),
	);

	register_taxonomy( 'types', array( 'programmes' ), $args );
}

Attached the image I removed (tax-no-items.PNG).

Last edited 10 years ago by iammathews (previous) (diff)

#3 @johnbillion
10 years ago

  • Keywords needs-patch added
  • Version changed from 4.0.1 to 2.3

I've noticed this before. As iammathews points out, it's not used on non-hierarchical taxonomies. I started patching this once before and must have gotten distracted.

#4 @SergeyBiryukov
10 years ago

  • Keywords has-patch added; needs-patch removed
  • Summary changed from Taxonomy (register_taxonomy) to 'not_found' taxonomy label should be used in the list table

Well, it's not used in the list table, regardless of whether the taxonomy is hierarchical.

30586.patch fixes that.

#5 @SergeyBiryukov
10 years ago

  • Keywords 4.2-early added
  • Milestone changed from Awaiting Review to Future Release

@iammathews
10 years ago

Screenshot of issue.

#6 @wonderboymusic
9 years ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 31035:

Use the 'not_found' label when there are no items for a taxonomy in the terms list table.

Props SergeyBiryukov.
Fixes #30586.

#7 @wonderboymusic
9 years ago

  • Milestone changed from Future Release to 4.2
Note: See TracTickets for help on using tickets.