I would like to show a list of child_pages on a parent page.
now WP shows me always a link to an autosave post from the parent page, the link is linking to error 404 and I don't know how to stop this.
Parent Pages name is *Hi
the child_pages
good
fun
I edit the page *Hi and now the list show me
*Hi with an false url
good
fun
my code to display the child pages is:
if ( is_page() ) :
global $post, $wpdb;
$parent_ID = ($post->post_parent) ? $post->post_parent : $post->ID;
$pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = $parent_ID");
if($pages) : foreach($pages as $post) : // child pages loop
setup_postdata($post);
......my stuff
endforeach; endif; // end child pages loop
endif;