post_parent) && is_numeric($post->post_parent) && ($post->post_parent != 0) ){ wp_redirect( get_permalink( $post->post_parent ), 301 ); exit(); wp_reset_postdata(); } else { header("HTTP/1.0 404 Not Found"); global $wp_query; $wp_query->is_search = false; $wp_query->is_page = false; $wp_query->is_home = false; $wp_query->current_post = false; $wp_query->is_preview = false; $wp_query->is_category = false; $wp_query->is_tag = false; $wp_query->is_posts_page = false; $wp_query->is_posts_page = false; $wp_query->is_post_type_archive = false; $wp_query->is_post_type_archive = false; $wp_query->is_archive = false; $wp_query->is_single = false; $wp_query->is_singular = false; $wp_query->is_404 = true; include_once '404.php'; exit(); } ?>