A WordPress-centric search engine for devs and theme authors



_page_traverse_name ›

Since2.9.0
Deprecatedn/a
_page_traverse_name ( $page_id, $children, $result )
Parameters: (3)
  • (int) $page_id Page ID.
    Required: Yes
  • (array) $children Parent-children relations (passed by reference).
    Required: Yes
  • (array) $result Result (passed by reference).
    Required: Yes
See:
Defined at:
Codex:

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

$children contains parent-children relations



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