Page redirect going to wrong page
-
A while back on a previous WordPress site I set up I used this code to redirect my main-nav to my first sub-nav link.
<?php /* Template Name: Redirect To First Child */ if (have_posts()) { while (have_posts()) { the_post(); $pagekids = get_pages("child_of=".$post->ID."&sort_column=menu_order"); $firstchild = $pagekids[0]; wp_redirect(get_permalink($firstchild->ID)); } } ?>
I’m using this same code on a new site, but it’s not working as intended. For example, it appears that it redirects to the lowest page ID instead of directing to the menu sort order. Any ideas why this would be happening?
Thanks,
Burt
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Page redirect going to wrong page’ is closed to new replies.