How can I do a php redirect?
-
Hello,
I am trying to do a simple php redirect by putting the following code at the very top of my header.php file. But I get a warning saying that output has been started at line 2. Which is the line that says <?php. I don’t understand why this is happening. I am not echoing anything. Is WP loop causing this? should I make changes? Please help.<?php if(have_posts()) : while(have_posts()) : the_post();?> <?php $externalLink = get_post_meta($post->ID,'link',TRUE); if($externalLink) { header("Location: $externalLink"); } ?> <?php endwhile; endif;?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘How can I do a php redirect?’ is closed to new replies.