Created
August 19, 2012 13:35
-
-
Save hansspiess/3394858 to your computer and use it in GitHub Desktop.
Wordpress: Redirect to first child page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$pagekids = get_pages( "child_of=".$post->ID."&sort_column=menu_order" ); | |
if ( $pagekids ) { | |
$firstchild = $pagekids[0]; | |
wp_redirect( get_permalink( $firstchild->ID ) ); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment