Walker::unset_children( object $e, array $children_elements )

Unset all the children for a given top level element.


Description Description


Parameters Parameters

$e

(object) (Required)

$children_elements

(array) (Required)


Top ↑

Source Source

File: wp-includes/class-wp-walker.php

	public function unset_children( $e, &$children_elements ) {
		if ( ! $e || ! $children_elements ) {
			return;
		}

		$id_field = $this->db_fields['id'];
		$id       = $e->$id_field;

		if ( ! empty( $children_elements[ $id ] ) && is_array( $children_elements[ $id ] ) ) {
			foreach ( (array) $children_elements[ $id ] as $child ) {
				$this->unset_children( $child, $children_elements );
			}
		}

		unset( $children_elements[ $id ] );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.7.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.