Question

Cannot modify header information

Posted October 17, 2017 1.2k views
WordPress Ubuntu 16.04

Hi everyone,

I keep getting this error:
Warning: Cannot modify header information - headers already sent by (output started at /custom_functions.php:1) in /wp-includes/option.php on line 837

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

Now, I checked my custom-function file, especially line 1 and can’t find anything.

Here it is:

<?php
/* ######################### Begin Registering Custom Widgets ######################### */
// Register the After Single Post widget to display 3 related posts
genesis_register_sidebar( array(
    'id' => 'after-single-post',
    'name' => 'After Single Post',
    'description' => 'Latest 3 posts after comments',
) );
// Register "Top Parallax" widget
genesis_register_sidebar( array(
    'id' => 'top-parallax',
    'name' => __( 'Top Parallax', 'mp' ),
    'description' => __( 'Top Parallax Widget.', 'mp' ),
) );
// Register "About" widget
genesis_register_sidebar( array(

Note: Since my file is long, I just pasted the first few lines.

I would appreciate any help.
Note: I can still access my backend and work. But the warning is displayed on top of every page I access.

Frond-end is fine.

This also caused the issue of not being able to login from site.com/wp-admin (which I used to be able to do). When I access this page, it gives me this warning on an otherwise totally white screen:

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

Thanks in advance.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

1 answer

Hello,

A quick way to fix that would be to enable output_buffering in your php.ini file.

Note that you might have to restart your Apache service after the change.

Hope that this helps!
Regards,
Bobby

Submit an Answer