I'm working with get_pages on a site that has a very clean and hierarchical structure.
As part of a template, I wanted to show child pages as part of the template's 'boilerplate'. Reading the Codex documentation, there are two parameters that seem relevant: parent
and child_of
.
I've been fiddling with them using a simple dump to the body of the page like this but I can't see how the two parameters fundamentally differ...except to offer the risk that they will clash.
For example, if i set child_of
to 17 (a valid page) and parent
to anything except 17 or -1...I get an empty array. Which makes sense...but...why two parameters? Backward compatibility I can't find when scanning around the docs and code?
Obligatory code used for testing:
$args = array(
'sort_order' => 'ASC',
'sort_column' => 'post_title',
'hierarchical' => 1,
'exclude' => '',
'include' => '',
'meta_key' => '',
'meta_value' => '',
'authors' => '',
'child_of' => 17,
'parent' => -1,
'exclude_tree' => '',
'number' => '',
'offset' => 0,
'post_type' => 'page',
'post_status' => 'publish'
);
print_r (get_pages($args));
So: Any reason there seem to be two parameters that do the same thing?