Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Page template to redirect to the first child page in WordPress
Template Name: Redirect To First Child
if (have_posts()) {
while (have_posts()) {
$pagekids = get_pages("child_of=".$post->ID."&sort_column=menu_order");
$firstchild = $pagekids[0];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.