From 6ca804ee7652d87c9aca35d4efcf37ab3e69768b Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Sat, 29 Mar 2014 06:08:15 +0000 Subject: [PATCH] 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 --- wp-includes/taxonomy.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index c2312d7f56..df209a50e1 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -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)); }