#41647 closed defect (bug) (invalid)
The nicename argument in get_category_parents works the opposite way
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Taxonomy | Keywords: | |
Focuses: | Cc: |
Description
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
animals/cats/british-shorthair/
But it should be vice versa.
The reason is this check within get_category_parents()
:
$format = $nicename ? 'slug' : 'name';
https://core.trac.wordpress.org/browser/tags/4.8/src/wp-includes/category-template.php#L50
but it looks like it should be:
$format = ! $nicename ? 'slug' : 'name';
Reading the old Codex page:
https://codex.wordpress.org/Function_Reference/get_category_parents
where it says:
$nicename (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)
Note: See
TracTickets for help on using
tickets.
ps: I meant to write above:
... and with
$nicename = true
it outputs