Accessing array elements (get_pages)
-
31-10-2019 - |
Question
I'm trying to access the page ID of the child so that I can recursively call the get_children function on that child (to get grandchildren).
if ($CurrentPage) {
$args = array(
'child_of' => $CurrentPage
);
$children = get_pages( $args );
foreach ($children as $key => $value) {
echo $key.'=>'.$value.'<br />';
} // End foreach.
} // End IF.
I actually get an error: Catchable fatal error: Object of class stdClass could not be converted to string
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange