A
A
Angelxalfa2015-01-19 22:29:51
PHP
Angelxalfa, 2015-01-19 22:29:51

Wordpress header error?

The site encountered an error
Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/u0036288.plsk.regruhosting.ru/httpdocs/rcentr-ug.com/wp-content/themes/rcentr -ug/header.php:6) in /var/www/vhosts/u0036288.plsk.regruhosting.ru/httpdocs/rcentr-ug.com/wp-content/plugins/aws-cabinet/includes/shortcodes.php on line 109
line from header.php:6

<title><?php bloginfo('name'); ?><?php wp_title(); ?></title>

line from shortcodes.php on line 109:
setcookie("id", $data->base_id, time()+60*60*24*30, "/");

The site was working fine, and all of a sudden this error appeared...didn't do anything to the site before! Encoding of both UTF files without BOM.
What could be the problem, please help!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alex, 2015-01-20
@Angelxalfa

There was also a similar problem. I had to refuse to set cookies through a shortcode.
Attached an event handler

add_action( 'init', 'set_cookie'); 
function set_cookie(){
if(isset($_POST['base_id']))
   setcookie("id", $_POST['base_id'], time()+60*60*24*30, "/");
exit;
}

D
Dmitry, 2015-01-19
@dimsog

Cookies are set after string output has already been done.

A
Angelxalfa, 2015-01-19
@Angelxalfa

Registered at the beginning
<? ob_start();?>
and at the end of the page
<?ob_end_flush();?>
Everything worked....

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question