we solved header function issue with WordPress. If you are facing issue with redirecting the one page or post to another page.
All PHP programmer always first try header() function. But when you use header function in worpdress that will not allow you to redirect the page.
Solved: header function issue with WordPress
Instead of using the header function please use wp_redirect() function which is provided by WordPress API.
<?php
global $post; // if outside the loop
if ( is_page() && $post->post_parent ) {
// This is a subpage
wp_redirect(get_option(‘siteurl’) . ‘/wp-login.php’);
} else {
// This is not a subpage
wp_redirect(get_option(‘siteurl’) . ‘/wp-login.php’);
}
?>
Use following URLs for reference.
http://codex.wordpress.org/Conditional_Tags
http://codex.wordpress.org/Function_Reference/wp_redirect