wp/wp-includes/class-wp-walker.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
--- a/wp/wp-includes/class-wp-walker.php	Tue Dec 15 15:52:01 2020 +0100
+++ b/wp/wp-includes/class-wp-walker.php	Wed Sep 21 18:19:35 2022 +0200
@@ -143,7 +143,7 @@
 
 		$this->start_el( $output, $element, $depth, ...array_values( $args ) );
 
-		// Descend only when the depth is right and there are childrens for this element.
+		// Descend only when the depth is right and there are children for this element.
 		if ( ( 0 == $max_depth || $max_depth > $depth + 1 ) && isset( $children_elements[ $id ] ) ) {
 
 			foreach ( $children_elements[ $id ] as $child ) {
@@ -342,7 +342,7 @@
 		$top_level_elements = array();
 		$children_elements  = array();
 		foreach ( $elements as $e ) {
-			if ( 0 == $e->$parent_field ) {
+			if ( empty( $e->$parent_field ) ) {
 				$top_level_elements[] = $e;
 			} else {
 				$children_elements[ $e->$parent_field ][] = $e;
@@ -412,7 +412,7 @@
 		$parent_field = $this->db_fields['parent'];
 
 		foreach ( $elements as $e ) {
-			if ( 0 == $e->$parent_field ) {
+			if ( empty( $e->$parent_field ) ) {
 				$num++;
 			}
 		}