_page_traverse_name

函数


_page_traverse_name ( $page_id, $children, $result )
Access
Private
参数
  • (int)
    $page_id
    Page ID.
    Required:
  • (array)
    $children
    Parent-children relations (passed by reference).
    Required:
  • (string[])
    $result
    Array of page names keyed by ID (passed by reference).
    Required:
相关
  • _page_traverse_name()
定义位置
  • wp-includes/post.php
    , line 5882
引入
2.9.0
弃用

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

$children contains parent-children relations

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