Alert: 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.

_page_traverse_name() WordPress Function

The _page_traverse_name() function is used to traverse all the pages in a WordPress installation by their name. It is useful for finding specific pages or for debugging purposes.

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

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


Description

$children contains parent-children relations

Top ↑

See also


Top ↑

Parameters

$page_id

(int)(Required)Page ID.

$children

(array)(Required)Parent-children relations (passed by reference).

$result

(string[])(Required)Array of page names keyed by ID (passed by reference).


Top ↑

Source

File: wp-includes/post.php

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


Top ↑

Changelog

Changelog
VersionDescription
2.9.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More