Avoid infinite recursion in get_term_children() when a term is incorrectly a parent of itself.

props kovshenin.
fixes #27123.

Built from https://develop.svn.wordpress.org/trunk@27837


git-svn-id: http://core.svn.wordpress.org/trunk@27671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2014-03-29 06:08:15 +00:00
parent 88e3ebe05b
commit 6ca804ee76

View File

@ -1107,6 +1107,10 @@ function get_term_children( $term_id, $taxonomy ) {
$children = $terms[$term_id];
foreach ( (array) $terms[$term_id] as $child ) {
if ( $term_id == $child ) {
continue;
}
if ( isset($terms[$child]) )
$children = array_merge($children, get_term_children($child, $taxonomy));
}