WordPress auto login user and header already sent error

Solution: 

Possibly following may resolve issue, I had this issue (header already sent) many time and mostly option 2 worked for me.

Option 1 : Remove any blank line at the end of functions.php file in WordPress

Option 2 : Add following function in wp-config.php at top most line and check. If needed after that than update permalink once.

ob_start();