Warning: Cannot modify header information - headers already sent by (output started at /var/www/wp-content/themes/Lamoon/includes/shortcodes/shortcodes.php:1) in /var/www/wp-includes/pluggable.php on line 1121
I just wanna ask a question, maybe someone of you already had the same problem. I was working and everything was perfect, and suddenly i got this…
Warning: Cannot modify header information - headers already sent by (output started at /var/www/wp-content/themes/Lamoon/includes/shortcodes/shortcodes.php:1) in /var/www/wp-includes/pluggable.php on line 1121
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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.
Enter your email to get $200 in credit for your first 60 days with DigitalOcean.
New accounts only. By submitting your email you agree to our Privacy Policy.
Hi there,
Just came across this and wanted to mention, for anyone who comes across this in the future, that this error typically occurs in PHP when you try to modify the HTTP headers after they’ve been sent to the browser. The most common reason for this is when there’s some output, even as little as a single blank line or white space, sent before calling functions like
header()
,session_start()
, orsetcookie()
.In your case, the error message indicates that output started at
/var/www/wp-content/themes/Lamoon/includes/shortcodes/shortcodes.php:1
. This suggests that some unexpected output (like a blank line, white space, or HTML) is occurring in theshortcodes.php
file, right at the first line.You can usually fix this issue by ensuring there’s no output, not even white space, before your PHP opening tag
<?php
. It’s good practice not to close your PHP tag at the end of the file to avoid any accidental white space after the tag.Here’s what you need to do:
Open the
/var/www/wp-content/themes/Lamoon/includes/shortcodes/shortcodes.php
file.Make sure that the very first thing in your file is the opening PHP tag
<?php
and that there are no spaces or blank lines before it.Check the end of your PHP file. If it has a closing PHP tag
?>
, you may want to remove it. This isn’t necessary and, by removing it, you prevent accidental white space from being added.Save your changes and re-upload the file to your server, then try reloading your website.
In general, it’s also a good idea to enable error reporting during development. This will make it easier to identify issues. You can do this by adding the following lines to the top of your PHP script:
Also, sometimes enabling output buffering via your PHP ini file might help. To enable output buffering globally for all your PHP scripts, you can change the
output_buffering
directive in yourphp.ini
file.Best,
Bobby
@c-outlet I suggest opening the file /var/www/wp-content/themes/Lamoon/includes/shortcodes/shortcodes.php in a text editor (nano or vim) and checking if the first line is empty.
Any whitespaces/newlines before the
<?php
tag can cause this error.Moreover since this is an issue with a premium theme you can ask them directly.
My friend has always the same error after they installed the Hungarian version of WordPress. As I know all problems were solved after reinstalling that, but the original, English version.