0

Hi there I have seen similar problems on the net about this issue but the resolutions I have tried have not worked.

i'm developing a word-press site for a client I have done this before without issue. However, this time when I uploaded the template to my test server for the clients viewing I encountered these errors.

Warning: Cannot modify header information - headers already sent by (output started at /homepages/0/d682858018/htdocs/clickandbuilds/test/wp-includes/option.php:1) in /homepages/0/d682858018/htdocs/clickandbuilds/test/wp-includes/option.php on line 808

Warning: Cannot modify header information - headers already sent by (output started at /homepages/0/d682858018/htdocs/clickandbuilds/test/wp-includes/option.php:1) in /homepages/0/d682858018/htdocs/clickandbuilds/test/wp-includes/option.php on line 809

I have gone to the file and the lines it is referring to are ;

    // The cookie is not set in the current browser or the saved value is newer.
$secure = ( 'https' === parse_url( admin_url(), PHP_URL_SCHEME ) );
setcookie( 'wp-settings-' . $user_id, $settings, time() + YEAR_IN_SECONDS, SITECOOKIEPATH, null, $secure );
setcookie( 'wp-settings-time-' . $user_id, time(), time() + YEAR_IN_SECONDS, SITECOOKIEPATH, null, $secure );
$_COOKIE['wp-settings-' . $user_id] = $settings;

Would appreciate some guidance as to what is causing the error and how to fix it.

Things I have tried;

  • *eliminating white space
  • *removing ?>
  • *combing through code in function.php and removing whitespace.
  • *reinstalling wordpress.

Some people have marked this question as similar to another question but as I have mentioned this is different it's something to do with the template. It works fine locally

Community
  • 1
  • 1
  • check if you are using `print` or `echo` – Muthu Kumaran Jul 14 '17 at 09:49
  • 4
    Possible duplicate of [How to fix "Headers already sent" error in PHP](https://stackoverflow.com/questions/8028957/how-to-fix-headers-already-sent-error-in-php) – Alex Tartan Jul 14 '17 at 09:49
  • Print or Echo in the header.php file ? or the options.php file. forgive me i need some context around your sentence. – Matthew James Jul 14 '17 at 10:38
  • Through some more research, I found out it must be something to do with my template. When I use one of the default themes it disappears. The Strange thing is this does not happen locally? What could be causing the issue? – Matthew James Jul 14 '17 at 11:29
  • You need to wrap your code in a function and hook to `init` function so that headers won't be sent when your code executes. – dingo_d Jul 14 '17 at 17:28

3 Answers3

0

try to upload template via file manager and just activate it in wp-admin.

Mahipal Patel
  • 543
  • 3
  • 15
0

Found the issue when I actually viewed the code in a separate editor it highlighter a space before the opening

Thanks for everyones comments.

0

for me this error was in my Prestashop site(v 1.6.0.6) homepage and solved by lowering site php version from 5.6 to 5.3 in cpanel => MultiPHP Manager section.

so if you prefer more detail and manual editing, check .htaccess file and add following line to it

AddHandler application/x-httpd-php53.php
Iman
  • 17,932
  • 6
  • 80
  • 90