WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#16172 closed defect (bug) (fixed)

No label property for post_format taxonomy.

Reported by: mfields Owned by:
Milestone: 3.1 Priority: normal
Severity: normal Version: 3.1
Component: Taxonomy Keywords: dev-feedback
Focuses: Cc:

Description

All core taxonomies except post_format have a non-empty value set for the label property.

The following code will dump all registered taxonomies in the administration panels.

function mfields_get_taxonomies() {
	var_dump( get_taxonomies( array(), 'objects' ) );	
}
add_action( 'admin_notices', 'mfields_get_taxonomies' );

A dump of all core taxonomies on my installation of 3.1RC2 can be viewed here: http://wordpress.pastebin.com/U2kbH3wM

Attachments (2)

16172.patch (455 bytes) - added by SergeyBiryukov 7 years ago.
16172.2.patch (454 bytes) - added by SergeyBiryukov 7 years ago.

Download all attachments as: .zip

Change History (11)

#1 @nacin
7 years ago

We can use 'Format' as an existing string for now.

Looks like _get_custom_object_labels() isn't doing its job properly.

#2 @SergeyBiryukov
7 years ago

There are empty values in create_initial_taxonomies() for some reason:

register_taxonomy( 'post_format', 'post', array(
	'public' => true,
	'hierarchical' => false,
	'labels' => array(
		'name' => '',
		'singular_name' => '',
	),

Patch included. However though “Format” is an existing string, “Formats” isn't. Not sure if we should use singular name for both fields. Perhaps this is the second actual i18n-change?

#3 @nacin
7 years ago

We can always just kill 'labels' and default to 'post_format'. It's not shown in the UI currently. 'Format' seems fine for both for now.

#5 @mfields
7 years ago

  • Cc michael@… added

Would it make sense to to set label directly? All other core taxonomies have this property set and it is very easy to pull out of the objects created by get_taxonomies(). I reported this because, while updating my Taxonomy Widget plugin to add support for post formats, I noticed that the label was missing. While this taxonomy is not part of the core administration panels, I think it would be great if plugins could easily add it to their UI's.

BTW, I used to get emails from all of the tickets that I posted here, but I have to manually subscribe to them now. Does this have something to do with the upgrade?

#6 @nacin
7 years ago

(In [17261]) Give the format taxonomy a name. props SergeyBiryukov, see #16172.

#7 @nacin
7 years ago

  • Milestone changed from Awaiting Review to 3.1
  • Resolution set to fixed
  • Status changed from new to closed

Let's leave this like this for now. You can only have one format anyway, so get_the_taxonomies() showing "Format:" rather than "Formats:" isn't the end of the world.

Michael, can you check your trac preferences to see ig your email is configured?

#8 @mfields
7 years ago

My bad, This is a perfect solution! I must have been tired when I wrote my last post and confused the arguments in register_taxonomy() with the properties of the object created by it :)

My email is configured, but, if I remember correctly, there used to be an option to get emailed on all tickets you create which I selected a while back but seems to have stopped working. Is the a better channel to address these concerns? Thanks!

Note: See TracTickets for help on using tickets.