walk_page_tree()WP 2.1.0

Retrieves HTML list content for page list.

No Hooks.

Return

String.

Usage

walk_page_tree( $pages, $depth, $current_page, $args );
$pages(array) (required)
-
$depth(int) (required)
-
$current_page(int) (required)
-
$args(array) (required)
-

Changelog

Since 2.1.0 Introduced.

Code of walk_page_tree() WP 6.0

function walk_page_tree( $pages, $depth, $current_page, $args ) {
	if ( empty( $args['walker'] ) ) {
		$walker = new Walker_Page;
	} else {
		/**
		 * @var Walker $walker
		 */
		$walker = $args['walker'];
	}

	foreach ( (array) $pages as $page ) {
		if ( $page->post_parent ) {
			$args['pages_with_children'][ $page->post_parent ] = true;
		}
	}

	return $walker->walk( $pages, $depth, $args, $current_page );
}