On this page
Walker::unset_children( object $element, array $children_elements )
Unsets all the children for a given top level element.
Parameters
$elementobject Required-
The top level element.
$children_elementsarray Required-
The children elements.
Source
File: wp-includes/class-wp-walker.php. View all references
public function unset_children( $element, &$children_elements ) {
if ( ! $element || ! $children_elements ) {
return;
}
$id_field = $this->db_fields['id'];
$id = $element->$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 ] );
}
Related
Uses
| Uses | Description |
|---|---|
| Walker::unset_children() wp-includes/class-wp-walker.php | Unsets all the children for a given top level element. |
Used By
| Used By | Description |
|---|---|
| Walker::paged_walk() wp-includes/class-wp-walker.php | Produces a page of nested elements. |
| Walker::unset_children() wp-includes/class-wp-walker.php | Unsets all the children for a given top level element. |
Changelog
| Version | Description |
|---|---|
| 2.7.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/walker/unset_children