Warning: Cannot modify header information - headers already sent by

Hello, I started to get this error and have no idea why:

Warning: Cannot modify header information - headers already sent by (output started at /home/learneu/public_html/wp-content/themes/x-child/functions.php:1) in /home/learneu/public_html/wp-includes/pluggable.php on line 1210

I am building a new site and this is the first time to see this warning. It is also the first time that I modified the X-child functions.php and this message is showing since that time. I have already removed my custom code from the functions.php, but the warnings are still here.

The issues I am seeing now:

  • I cannot upload a new plugin (wanted to upload Yoast - I only get the spinning grey circle)
  • When uploading a new image to the media library, I can upload it, but when uploaded, I get the message “Warning: Cannot modify header information - headers already sent by (output started at /home/learneu/public_html/wp-content/themes/x-child/functions.php:1) in /home/learneu/public_html/wp-admin/async-upload.php on line 35
    234” and CRUNCHING… in the right corner
  • If I want to remove an image, I again get the same warning…
  • If I want to see my media library in a grid view, nothing shows, except for the grey circle spinning around. The list view shows normally.
  • If I access my site through the address https://learn-eu.net, it is OK. If I enter https://www.learn-eu.net, I again get the same warning.

I have 8 live sites in X-theme, I always use the same plugins (actually here I have only the very basic plugins for now, way less than on my other sites, so it is probably not a plugin issue). And when I for a minute activated the 2017 theme, the media library was showing all the images in the grid view correctly, so it is most probably X-related.

Can you please help me because this is really driving me mad and I have to give the site to my client ASAP.

Thanks a lot in advance
Alenka

Something added to you child theme is producing PHP output when it shouldn’t.

Make sure you don’t have an empty line before your opening PHP tag. So this is correct:

==top of file==
<?php

This isn’t - note the extra blank line at the top of the file.

==top of file==

<?php

Anything not enclosed in PHP tags, including line breaks will be treated as “output” and will trigger headers being sent.

Hi, Alexander and thanks for your quick answer,
I have checked my file and there are no empty lines at the beginning…
Any other ideas?

Hi Alenka,

In that case, would you mind providing the URL to your site and the admin and FTP details in a Secure Note so that we can check it?

Thank you.

I sent you all the details in the secure note (answered to the previous message by Alexander because this message does not allow for secure note).
As foreign IPs are blocked on my host, I sent you the alternative approach.
Hope you can help me…
Thanks in advance
Alenka

Hi Alexa,

I checked and there’s a space before <?php in your child theme’s functions.php. Please remove it.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.