<?php
if(is_user_logged_in()){
//do something
}else{
wp_redirect( wp_login_url() );
exit;
}
?>
So I try to do that, but get a header already sent error by Divi.
Warning: Cannot modify header information - headers already sent by (output started at /public_html/wp-content/themes/Divi/header.php:1) in /public_html/wp-includes/pluggable.php on line 1265
Is this a common error, any ideas to fix that?