1

I am having a strange issue with the wp-admin page of a WordPress site.

I have enabled errors and receive the following warning when requesting /wp-admin/:

Warning: Cannot modify header information - headers already sent by (output started at wp-config.php:1) in wp-includes/pluggable.php on line 1216

I have checked the files and do not have any whitespace at the beginning of the wp-config file.

Any ideas?

4
  • 1
    Did you install a new theme or plugin when this started? What triggered the white screen?
    – jdm2112
    Jun 7, 2018 at 15:22
  • It's more likely you've got whitespace at the end of a file (probably a plugin or a theme file). One way to avoid this is to not use PHP's ?> closing tags at the end of a file -- they're unnecessary anyway.
    – Pat J
    Jun 7, 2018 at 15:23
  • nope, no new themes or plugins, a new post was posted on 15th May.
    – martinkerr
    Jun 7, 2018 at 15:37
  • there are no ?> at the end of the files, although there is a carriage return
    – martinkerr
    Jun 7, 2018 at 15:37

3 Answers 3

2

I'd comment on Fayaz's answer, but I don't have enough reputation to comment. So here's my additional advice:

Along with checking hidden white space characters in wp-config.php file and elsewhere, I'd recommend you to temporarily disable all plugins and switch to the default WordPress Theme (e.g. Twenty Seventeen Theme). Then check if you still have the error.

If error / warning is still shown after doing the above, then definitely it's coming from core files, so follow Fayaz's instruction on removing whitespace, by creating new wp-config.php file.

However, if no error / warning is shown after doing the above, then it's not coming from wp-config.php, rather from your theme or a plugin. In this case, enable the theme & plugins one by one & check which one causes the error.

You say you didn't install new Theme / Plugin, but it's possible that the error was there forever & only now it's showing after enabling PHP error reporting.

Note: It's also a good idea to clear browser cache before you do this test. Sometimes browsers show output from older sessions & that may confuse you while you test.

1
  • 1
    Or, perhaps a plugin was updated ;)
    – Fayaz
    Jun 7, 2018 at 23:52
1

This means, somewhere there is some output coming from your wp-config.php file.

Or, may be there is space or carriage return before <?php tag

Or, may be there is space or carriage return after ?> tag.

Or, may be even a minor PHP syntax error that's closing the ?> without you intending it.

It'll be Clear if you check the PHP error logs on your server.


Note-1: if whitespace is difficult to find, create a new file from scratch and rename the old file as backup. Sometimes some unicode whitespace characters are not shown within the editors properly, even though it's there.


Note-2: Whitespace may've come from Theme/Plugin updates as well, so you better check & make sure those are OK too.

-1

So.... tried all of the above and nothing worked.

So i ended up restoring all of the core Wordpress files which seems to have fixed the issue.

Thanks for your thoughts anyway

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.