From 56a74de876a57ab6ddce255d5762409f91f978aa Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Fri, 1 Dec 2006 00:38:25 +0000 Subject: [PATCH] Close previous element when depth is hit. fixes #3080 git-svn-id: https://develop.svn.wordpress.org/trunk@4564 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/classes.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wp-includes/classes.php b/wp-includes/classes.php index 966e42e34c..b55d8ef976 100644 --- a/wp-includes/classes.php +++ b/wp-includes/classes.php @@ -430,6 +430,9 @@ class Walker { if ( !$to_depth || ($depth < $to_depth) ) { //only descend if we're below $to_depth $cb_args = array_merge( array($output, $depth - 1), $args); $output = call_user_func_array(array(&$this, 'start_lvl'), $cb_args); + } else { // If we've reached depth, end the previous element. + $cb_args = array_merge( array($output, $previous_element, $depth - 1), $args); + $output = call_user_func_array(array(&$this, 'end_el'), $cb_args); } } else if ( $element->$parent_field == $previous_element->$parent_field) { // On the same level as previous element.