> Change $page to something like $mypage and you will be good. There
> are numerous global vars from the global scope that can be overwritten
> which will cause such issues. Also stay away from $post, $p, etc...
Yet another solution is to put this code into a function so that you
are not setting variables within the global scope.
Something like:
function get_child_ids( $parent = 0 ) {
$pages = get_pages( array( 'child_of' => $parent ) );
$pageids = array();
if ( ! empty( $pages) ) {
foreach ($pages as $page)
$pageids[] = $page->ID;
}
return $pageids;
}
echo "<pre>";
var_dump( get_child_ids(19) );
echo "</pre>";
Also just something to point out, you should generally not try to run
anything until at least the init action, not that it would have solved
anything here, just good practice.
--
Matt Martz
[email protected]
http://sivel.net/
_______________________________________________
wp-testers mailing list
[email protected]
http://lists.automattic.com/mailman/listinfo/wp-testers