Possible Duplicate:
“Warning: Cannot modify header information – headers already sent by” error
In building a login form to plug into the wordpress system, all of a sudden despite working earlier. Ignore these stars in the error they are just to avoid public display of the webste.
Warning: Cannot modify header information - headers already sent by (output started at /home/divethe1/public_html/**********.com/wp-content/themes/RIKsoft/header.php:2) in /home/divethe1/public_html/********.com/wp-includes/pluggable.php on line 738
The codex says this is caused by space before and after the opening and closing , but there is not any. The offending line, ie. the one I can remove is $user = wp_signon( $creds, false ); to make it not cause this error, however then it doesn’t do what I want it to.
The code
<?php get_header(); ?>
<?php
$creds = array();
$creds['user_login'] = $_POST['LOGuser'];
$creds['user_password'] = $_POST['LOGpass'];
$creds['remember'] = true;
$user = wp_signon( $creds, false );
if ( is_wp_error($user) )
echo $user->get_error_message();
?>
<?php if ( is_user_logged_in() ) { wp_redirect( $_POST['redirect'] ); exit; }
else { ?>
<div class="panel log autoc">
<div class="title"><b>LOG IN</b></div>
<form action="http://www.robin-knight.com/access/" method="post">
<label>Email Address<input name="LOGuser" type="text"></label>
<label>Password<input name="LOGpass" type="password"></label>
<input type="submit" class="button" value="Log In">
</form>
</div>
<?php }?>
<?php get_footer();?>
The headers have already been sent because some content has been sent (the space between your
<?php ?>tags – yes, space is content too), content requires headers to be sent first, and you can’t modify the headers after they have already been sent.Combine the two into one to eliminate the space between them by changing
to