Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#41647 closed defect (bug) (invalid)

The nicename argument in get_category_parents works the opposite way

Reported by: birgire's profile birgire Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords:
Focuses: Cc:


Here's an example:

echo get_category_parents( 338, $link = false, $separator = '/', $nicename = false );

that outputs:

Animals/Cats/British Shorthair Cat/

and with $nicename = false it outputs


But it should be vice versa.

The reason is this check within get_category_parents():

$format = $nicename ? 'slug' : 'name';

but it looks like it should be:

$format = ! $nicename ? 'slug' : 'name';

Reading the old Codex page:

where it says:

(boolean) (optional) Whether to use nice name for display. If set to true, the category slug will be used instead of the category name.
Default: false

I wonder if this vice-versa has just been accepted as is.

Hope I'm not misunderstanding things here.

Change History (3)

#1 @birgire
7 years ago

ps: I meant to write above:

... and with $nicename = true it outputs


#2 @birgire
7 years ago

  • Resolution set to invalid
  • Status changed from new to closed

ok, I it's me that got confused the nicename here ;-)

it's the slug that is usually meant as nicename.

This ticket should be deleted, so I mark it as invalid, thanks

#3 @SergeyBiryukov
7 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.