[wp-trac] [WordPress Trac] #27123: get_categories returning duplicate child categories in 3.9
WordPress Trac
noreply at wordpress.org
Thu Feb 20 02:00:58 UTC 2014
#27123: get_categories returning duplicate child categories in 3.9
------------------------------------------+--------------------
Reporter: BStofko | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 3.9
Component: Taxonomy | Version: trunk
Severity: normal | Resolution:
Keywords: needs-patch needs-unit-tests | Focuses:
------------------------------------------+--------------------
Changes (by SergeyBiryukov):
* component: General => Taxonomy
Old description:
> Executing the get_categories function for child categories returns
> duplicate entries in version 3.9. This worked in version 3.8.1 so this is
> something new.
>
> My call:
>
> {{{
> $terms = get_categories( array ('child_of' => $cat));
> }}}
>
> Under version 3.8.1 returns:
>
> {{{
> terms:Array ( [0] => stdClass Object ( [term_id] => 7 [name] => Child
> Category I [slug] => child-category-i [term_group] => 0
> [term_taxonomy_id] => 7 [taxonomy] => category [description] => [parent]
> => 4 [count] => 1 [cat_ID] => 7 [category_count] => 1
> [category_description] => [cat_name] => Child Category I
> [category_nicename] => child-category-i [category_parent] => 4 ) )
>
> }}}
>
> Under version 3.9 returns:
>
> {{{
> terms:Array ( [0] => stdClass Object ( [term_id] => 7 [name] => Child
> Category I [slug] => child-category-i [term_group] => 0
> [term_taxonomy_id] => 7 [taxonomy] => category [description] => [parent]
> => 4 [count] => 1 [cat_ID] => 7 [category_count] => 1
> [category_description] => [cat_name] => Child Category I
> [category_nicename] => child-category-i [category_parent] => 4 ) [4] =>
> stdClass Object ( [term_id] => 7 [name] => Child Category I [slug] =>
> child-category-i [term_group] => 0 [term_taxonomy_id] => 7 [taxonomy] =>
> category [description] => [parent] => 4 [count] => 1 [object_id] => 1746
> [filter] => raw [cat_ID] => 7 [category_count] => 1
> [category_description] => [cat_name] => Child Category I
> [category_nicename] => child-category-i [category_parent] => 4 ) )
>
> }}}
New description:
Executing the get_categories function for child categories returns
duplicate entries in version 3.9. This worked in version 3.8.1 so this is
something new.
My call:
{{{
$terms = get_categories( array ('child_of' => $cat));
}}}
Under version 3.8.1 returns:
{{{
terms: Array (
[0] => stdClass Object (
[term_id] => 7
[name] => Child Category I
[slug] => child-category-i
[term_group] => 0
[term_taxonomy_id] => 7
[taxonomy] => category
[description] =>
[parent] => 4
[count] => 1
[cat_ID] => 7
[category_count] => 1
[category_description] =>
[cat_name] => Child Category I
[category_nicename] => child-category-i
[category_parent] => 4
)
)
}}}
Under version 3.9 returns:
{{{
terms: Array (
[0] => stdClass Object (
[term_id] => 7
[name] => Child Category I
[slug] => child-category-i
[term_group] => 0
[term_taxonomy_id] => 7
[taxonomy] => category
[description] =>
[parent] => 4
[count] => 1
[cat_ID] => 7
[category_count] => 1
[category_description] =>
[cat_name] => Child Category I
[category_nicename] => child-category-i
[category_parent] => 4
)
[4] => stdClass Object (
[term_id] => 7
[name] => Child Category I
[slug] => child-category-i
[term_group] => 0
[term_taxonomy_id] => 7
[taxonomy] => category
[description] =>
[parent] => 4
[count] => 1
[object_id] => 1746
[filter] => raw
[cat_ID] => 7
[category_count] => 1
[category_description] =>
[cat_name] => Child Category I
[category_nicename] => child-category-i
[category_parent] => 4
)
)
}}}
--
Comment:
Confirmed, working on a patch and unit tests.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/27123#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list