post_parent ) ? get_permalink( $post->post_parent ) : false; $url = $parent ?: home_url( '/' ); wp_safe_redirect( $url, 301 ); exit; } }