Title: _page_traverse_name
Published: April 25, 2014
Last modified: May 20, 2026

---

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

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/_page_traverse_name/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/functions/_page_traverse_name/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/functions/_page_traverse_name/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/functions/_page_traverse_name/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/_page_traverse_name/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/_page_traverse_name/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/_page_traverse_name/?output_format=md#wp--skip-link--target)

This function’s access is marked private. This means it is not intended for use 
by plugin or theme developers, only by core. It is listed here for completeness.

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

## 󠀁[Description](https://developer.wordpress.org/reference/functions/_page_traverse_name/?output_format=md#description)󠁿

$children contains parent-children relations

### 󠀁[See also](https://developer.wordpress.org/reference/functions/_page_traverse_name/?output_format=md#see-also)󠁿

 * [_page_traverse_name()](https://developer.wordpress.org/reference/functions/_page_traverse_name/)

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/_page_traverse_name/?output_format=md#parameters)󠁿

 `$page_id`intrequired

Page ID.

`$children`arrayrequired

Parent-children relations (passed by reference).

`$result`string[]required

Array of page names keyed by ID (passed by reference).

## 󠀁[Source](https://developer.wordpress.org/reference/functions/_page_traverse_name/?output_format=md#source)󠁿

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

[View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/post.php#L6320)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/post.php#L6320-L6327)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/_page_traverse_name/?output_format=md#related)󠁿

| Uses | Description | 
| [_page_traverse_name()](https://developer.wordpress.org/reference/functions/_page_traverse_name/)`wp-includes/post.php` |

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

  |

| Used by | Description | 
| [get_page_hierarchy()](https://developer.wordpress.org/reference/functions/get_page_hierarchy/)`wp-includes/post.php` |

Orders the pages with children under parents in a flat list.

  | 
| [_page_traverse_name()](https://developer.wordpress.org/reference/functions/_page_traverse_name/)`wp-includes/post.php` |

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

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/_page_traverse_name/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2F_page_traverse_name%2F)
before being able to contribute a note or feedback.