Functions.php file blank

I tried to add some lines of code to my functions.php file, there was an issue on the Wordpress editor and now the file is blank. how can I restore the file?

Best,

Marc

I have tried restore the functions.php file and now I get the following when trying to load the site

Warning: Cannot modify header information - headers already sent by (output started at /homepages/7/d463659002/htdocs/clickandbuilds/Lavask500152/wp-content/themes/x/functions.php:1) in /homepages/7/d463659002/htdocs/clickandbuilds/Lavask500152/wp-includes/pluggable.php on line 1219

the site is https://lavask.com/

Hello Blake,

Thanks for asking. :slight_smile:

Please try activating parent theme and see if the error message is showing up. If it’s not then you need to remove the customizations added into child theme.

You can also add following article to stop debugging and remove error message. Please note that article talks about activating debug. All that needs o be done is the opposite of the same. https://www.a2hosting.in/kb/installable-applications/optimization-and-configuration/wordpress2/debugging-wordpress

Thanks.

Hi Prasant,

Thank you for your reply.

I did not have a child theme acticated to begin with.

And now I cannot login to wordpress, when I open https://lavask.com/wp-admin/
I get the following.

Warning: Cannot modify header information - headers already sent by (output started at /homepages/7/d463659002/htdocs/clickandbuilds/Lavask500152/wp-content/themes/x/functions.php:1) in /homepages/7/d463659002/htdocs/clickandbuilds/Lavask500152/wp-includes/pluggable.php on line 1219

The website seems to be working but when I make any changes I also get the above message.

Hello @blake1marc,

I have resolved the issue. There was three empty lines at the very beginning of the functions.php file. I would not recommend that you edit the parent theme’s functions.php file. If what you are trying to accomplish requires a template customization, we would highly to suggest that you use a child theme. This allows you to make code changes that won’t be overwritten when an X update is released.

After the child theme is set up, please go to Appearance > Editor and add your code in your child theme’s functions.php file.

Hope this helps.

Thank you so much, you are an absolute lifesaver! :sweat_smile: Much appreciated!

You are most welcome. :slight_smile:

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