Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#21094 closed defect (bug) (invalid)

Remove unnecessary 'menu_name' fallback in get_post_type_labels()

Reported by: evansolomon's profile evansolomon Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: has-patch
Focuses: Cc:

Description

get_post_type_labels() sets the fallback for the menu_name label to the name label. Then it calls _get_custom_object_labels(), which does the same thing along with a bunch of similar fallbacks.

This is an artifact of #14832, which lead to r16251, then to r16268, which made the fallback in get_post_type_labels() unnecessary.

We can just remove the statement from get_post_type_labels() and nothing will change (except WordPress will be just a bit simpler).

Attachments (1)

21094.diff (496 bytes) - added by evansolomon 13 years ago.

Download all attachments as: .zip

Change History (2)

@evansolomon
13 years ago

#1 @duck_
13 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

The line isn't unnecessary. If $object->labels['name'] isn't set at that point then there will be no fallback. For example:

register_post_type( 'example', array( 'public' => true ) );

Now there will be a notice during menu generation and the menu item will have no label.

Maybe it's unlikely to occur, but this fallback code does do something.

Note: See TracTickets for help on using tickets.