WordPress at a glance
function is not described

_page_traverse_name() WP 2.9.0

Traverse and return all the nested children post names of a root page.

$children contains parent-children relations

This is an internal function for using it by WP core itself. It's not recommended to use this function in your code.

No Hooks.

Return

````. Null. Nothing.

Usage

_page_traverse_name( $page_id, $children, $result );
$page_id(int) (required) (passed by reference — &)
Page ID.
$children(array) (required) (passed by reference — &)
Parent-children relations (passed by reference).
$result(string[]) (required) (passed by reference — &)
Array of page names keyed by ID (passed by reference).

Notes

  • See: _page_traverse_name()

Changelog

Since 2.9.0 Introduced.

Code of _page_traverse_name() WP 5.7

<?php
function _page_traverse_name( $page_id, &$children, &$result ) {
	if ( isset( $children[ $page_id ] ) ) {
		foreach ( (array) $children[ $page_id ] as $child ) {
			$result[ $child->ID ] = $child->post_name;
			_page_traverse_name( $child->ID, $children, $result );
		}
	}
}