Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#20678 closed defect (bug) (invalid)

Custom post type 'name' is slug instead of plural label

Reported by: thomask Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.4
Component: General Keywords:
Focuses: Cc:


If you look into get_queried_object() object on build-in archive pages, the object->name contanins plural label of that categoriy, e.g. 'My news'.

If you do the same on CPT, it contains slug, e.g. "my-news"

The same is returned when you do post_type_archive_title() - so slug for CPT, Plural name for categories.

Change History (4)

#1 @thomask
6 years ago

sorry, the last sentence is wrong, post_type_archive_title returns it right (title, not slug)

#2 @scribu
6 years ago

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

You're comparing apples to oranges:

  • post type archive -> custom post type object
  • term archive -> term object (not taxonomy object)

If we had such a thing as taxonomy archives (#17567), 'name' would be the taxonomy slug, as expected.

Last edited 6 years ago by scribu (previous) (diff)

#3 @scribu
6 years ago

To clarify:

  • term archive: /categories/my-news
  • taxonomy archive: /categories/
Version 0, edited 6 years ago by scribu (next)

#4 @scribu
6 years ago

And no, it's too late to change 'name' to be consistent between term objects and CPT objects.

Note: See TracTickets for help on using tickets.