Hi I added this hook to be added before the <head> section, but I get an error.
The code is added into th functions.php file
This is the hook (if the user is not logged in, show a temp page):
add_action( 'generate_before_header','ds_temp_page' ,1);
function ds_temp_page() { ?>
<?php if(!is_user_logged_in()){wp_redirect( 'http://www.golancoalition.org/_index.html' ); exit;}?>
<?php }
The error I get is:
Warning: Cannot modify header information – headers already sent by (output started at C:\xampp\htdocs\golanco\wp-includes\formatting.php:5103) in C:\xampp\htdocs\golanco\wp-includes\pluggable.php on line 1216
Any thoughts on why this is happening?
Thanks,
Dan