_page_traverse_name( int $page_id, array $children, string[] $result )

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Use _page_traverse_name() instead.

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

Description

$children contains parent-children relations

See also

Parameters

$page_idintrequired
Page ID.
$childrenarrayrequired
Parent-children relations (passed by reference).
$resultstring[]required
Array of page names keyed by ID (passed by reference).

Source

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

Changelog

VersionDescription
2.9.0Introduced.

User Contributed Notes

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