Solve the problem of “cannot modify header information” in WordPress

Today, when debugging the WordPress theme, we had an error prompt “warning: cannot modify header information – headers already sent by” on the page. It seems that there are some problems with the compatibility of plugins or themes, so he went through the relevant problems to find out what the problem is. There is no problem for me to switch to other topics. It can be seen that the problem is in the current topic.

So I uninstall all the plugins first, and then I see some errors when the current theme is active. It can be concluded that there is a problem with the theme.

1. Coding conflict

This error is mentioned on the Internet because of UTF-8 coding conflict. So I will open all the main files of the current topic in Notepad, and then save them as new UTF-8 code.

2、ob_ The problem of start() function

The solutions mentioned by some websites are as follows:

add_ action(‘init’, ‘do_ output_ buffer’);function do_ output_ buffer() {ob_ start();}

You need to add the script and see if there are any errors.

Finally, I found it in the server configuration through php.ini Then put the output_ Change off in buffering to on, restart the Apache, and see that the problem can be solved.

Related Article
WordPress displays the registration time of the login user in the frontend

When using WordPress to build a website, some users want to display the user registration time in the frontend, but Read more

WordPress adds the number of SQL queries at the bottom

An excellent woodpress theme is definitely that the less SQL consulting is used, the better. How can we see how Read more

Some WordPress articles can be seen after comments / replies

If we want to hide part of the content of the article and need the user's comments and replies to Read more

WordPress common template function reference document

Basic template filefile namedescribe style.css Theme style file index.php Home page template file header.php Header template file single.php Single article Read more

Leave a Reply

Your email address will not be published. Required fields are marked *

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-spam image