WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 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:

Description

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)

comment:1 thomask2 years ago

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

comment:2 scribu2 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
  • taxonomy archive -> term object (not taxonomy object)

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

Version 0, edited 2 years ago by scribu (next)

comment:3 scribu2 years ago

To clarify:

  • term archive: /categories/my-news/
  • taxonomy archive: /categories/ (not implemented)
Last edited 2 years ago by scribu (previous) (diff)

comment:4 scribu2 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.