WordPress at a glance
function is not described

Walker::unset_children() public WP 2.7.0

Unset all the children for a given top level element.

{} It's a method of the class: Walker{}

No Hooks.

Return

null. Nothing.

Usage

$Walker = new Walker();
$Walker->unset_children( $e, $children_elements );
$e(object) (required)
-
$children_elements(array) (required) (passed by reference — &)
-

Changelog

Since 2.7.0 Introduced.

Code of Walker::unset_children() WP 5.7.2

<?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 ] );
}