I exported just the pages from one WP install to another and it was successful. When I go to the pages list, it displays them all and shows parent/child relationships, but doesn't seem to be recognized anymore when using some custom code in the template. It works on the original site just fine and I compared WP versions; they're the same.
Here is the code I'm using:
$my_wp_query = new WP_Query();
$all_wp_pages = $my_wp_query->query(array('post_type' => 'page', 'orderby' => 'date', 'order' => 'ASC'));
// Get the page as an Object
$products = get_page_by_title('Products');
// Filter through all pages and find Products' children
$products_children = get_page_children($products->ID, $all_wp_pages);
// echo what we get back from WP to the browser
echo '<ul id="product-nav">';
foreach($products_children as $child){
echo '<li><a href="'.get_page_link($child->ID).'" title="'.$child->post_title.'">';
echo get_the_post_thumbnail($child->ID).'<span>'.$child->post_title.'</span>';
echo '</a></li>';
}
echo '</ul>';
When I performed a var_dump()
on $all_wp_pages
, they aren't being displayed there either. It's as if they don't exist, but show up on the back end as expected. Finally, I tried changing one of the child page's parent, then back again in hopes that would reset it, but had the same result.
Any idea why this would be happening?