1

I ran into an issue. When I am trying to activate a plugin, any plugin, I am getting a white screen. I tried to change theme and it just won't let me.

I then went to wp-config.php and turned on debugging and these are the errors I am getting when trying to change theme:

Notice: yith_wcwl_products cookie cannot be set - headers already sent by /home1/website/public_html/wp-content/themes/flatsome-child/functions.php on line 1 in /home1/website/public_html/wp-content/plugins/woocommerce/includes/wc-core-functions.php on line 835

Notice: Constant WP_CRON_LOCK_TIMEOUT already defined in /home1/website/public_html/wp-config.php on line 91

Notice: Constant AUTOSAVE_INTERVAL already defined in /home1/website/public_html/wp-config.php on line 92

Notice: Constant WP_POST_REVISIONS already defined in /home1/website/public_html/wp-config.php on line 93

Notice: Constant EMPTY_TRASH_DAYS already defined in /home1/website/public_html/wp-config.php on line 94

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home1/website/public_html/wp-content/themes/flatsome-child/functions.php:1) in /home1/website/public_html/wp-content/plugins/flexible-shipping/classes/flexible-shipping-plugin.php on line 169

Warning: Cannot modify header information - headers already sent by (output started at /home1/website/public_html/wp-content/themes/flatsome-child/functions.php:1) in /home1/website/public_html/wp-admin/includes/misc.php on line 1124

These are the errors when trying the activate a plugin:

Notice: yith_wcwl_products cookie cannot be set - headers already sent by /home1/website/public_html/wp-content/themes/flatsome-child/functions.php on line 1 in /home1/website/public_html/wp-content/plugins/woocommerce/includes/wc-core-functions.php on line 835

Notice: Constant WP_CRON_LOCK_TIMEOUT already defined in /home1/website/public_html/wp-config.php on line 91

Notice: Constant AUTOSAVE_INTERVAL already defined in /home1/website/public_html/wp-config.php on line 92

Notice: Constant WP_POST_REVISIONS already defined in /home1/website/public_html/wp-config.php on line 93

Notice: Constant EMPTY_TRASH_DAYS already defined in /home1/website/public_html/wp-config.php on line 94

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home1/website/public_html/wp-content/themes/flatsome-child/functions.php:1) in /home1/website/public_html/wp-content/plugins/flexible-shipping/classes/flexible-shipping-plugin.php on line 169

Warning: Cannot modify header information - headers already sent by (output started at /home1/website/public_html/wp-content/themes/flatsome-child/functions.php:1) in /home1/website/public_html/wp-admin/includes/misc.php on line 1124

Warning: Cannot modify header information - headers already sent by (output started at /home1/website/public_html/wp-content/themes/flatsome-child/functions.php:1) in /home1/website/public_html/wp-includes/pluggable.php on line 1219

Warning: Cannot modify header information - headers already sent by (output started at /home1/website/public_html/wp-content/themes/flatsome-child/functions.php:1) in /home1/website/public_html/wp-includes/pluggable.php on line 1219

My flatsome-child/function.php file is empty.

I am assuming there errors creates more problems throughout the website.

How can I fix this?

Thanks.

  • 1
    You mentioned flatsome-child/function.php is empty, but is it completely empty, i.e. is there any whitespace in there at all? This article might help - stackoverflow.com/questions/8028957/… – junkrig Aug 2 '18 at 6:18
  • 1
    The problem when activating a plugin or theme was caused apparently because of white-spaces. I uploaded the original function.php given with the theme and problem solved. Though I still get the already defined stuff. I will look at the article you mentioned and will update soon. Thanks for the help! – Omer Aug 2 '18 at 6:29
  • The white-spaces also solved the headers already sent error. Can you please post an answer so I can mark this as solved? – Omer Aug 2 '18 at 7:06
  • Glad it's fixed @Omer, just posted as the answer :-) – junkrig Aug 2 '18 at 7:18
2

As described in this SO answer - https://stackoverflow.com/questions/8028957/how-to-fix-headers-already-sent-error-in-php whitespace before the opening <?php tag of a file can cause a "headers already sent error".

In particular, if the error message is indicating the problem is on line one of the file, this can point to leading whitespace before the first <?php tag (mentioned in point 3 of the above post).

Removing this whitespace from the file should correct the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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