Title: Put Navigation Tree into PHP Array
Last modified: August 19, 2016

---

# Put Navigation Tree into PHP Array

 *  [ryan-fait](https://wordpress.org/support/users/ryan-fait/)
 * (@ryan-fait)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/put-navigation-tree-into-php-array/)
 * Does anyone have a code snippet that will put the parents and children of $post-
   >ID into an array like this:
 *     ```
       array (
            [1] => 0,
            [3] => 0,
            [4] => array(19, 24, 36),
            [8] => array(41, 42, 43),
       )
       ```
   
    - The array key is the page ID
    - The value is 0 if there are no children
    - If there are children, the value is an array filled with their page ID’s

The topic ‘Put Navigation Tree into PHP Array’ is closed to new replies.

 * In: [Everything else WordPress](https://wordpress.org/support/forum/miscellaneous/)
 * 0 replies
 * 1 participant
 * Last reply from: [ryan-fait](https://wordpress.org/support/users/ryan-fait/)
 * Last activity: [16 years, 7 months ago](https://wordpress.org/support/topic/put-navigation-tree-into-php-array/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
