Last active
June 23, 2020 23:43
-
-
Save dallasread/e79647f3ec923f5b4cbb to your computer and use it in GitHub Desktop.
WP Redirect Template
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 | |
/* | |
Template Name: Redirect | |
*/ | |
if ($post->post_content != "") { | |
$url = wp_strip_all_tags($post->post_content); | |
} else if (!$post->post_parent) { | |
$children = get_pages("child_of=".$post->ID."&sort_column=menu_order"); | |
$url = get_permalink($children[0]->ID); | |
} | |
wp_redirect( $url, 301 ); | |
exit; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment