ID.'&parent='.$currentPageObject->ID.'&sort_column=menu_order'); $url = ""; if(!empty($subchildren)) { $firstPage = $subchildren[0]; $subchildren = get_pages('child_of='.$firstPage->ID.'&parent='.$firstPage->ID.'&sort_column=menu_order'); if(!empty($subchildren)) { $url = get_permalink($subchildren[0]->ID); } else { $url = get_permalink($firstPage->ID); } } else { $url = get_bloginfo('url'); } if(!empty($url)) { wp_redirect($url,301); exit; } ?>