[wp-trac] [WordPress Trac] #41647: The nicename argument in get_category_parents works the opposite way
WordPress Trac
noreply at wordpress.org
Tue Aug 15 16:35:18 UTC 2017
#41647: The nicename argument in get_category_parents works the opposite way
--------------------------+-----------------------------
Reporter: birgire | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version:
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41647>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list