wpseek.com
A WordPress-centric search engine for devs and theme authors



_page_traverse_name › WordPress Function

Since2.9.0
Deprecatedn/a
_page_traverse_name ( $page_id, $children, $result )
Access:
  • private
Parameters: (3)
  • (int) $page_id Page ID.
    Required: Yes
  • (array) $children Parent-children relations (passed by reference).
    Required: Yes
  • (string[]) $result Array of page names keyed by ID (passed by reference).
    Required: Yes
See:
Defined at:
Codex:

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