Wordpress - Warning Cannot modify header information - headers already sent by - functions.php - решение: различия между версиями

Материал из Wiki - Iphoster - the best ever hosting and support. 2005 - 2024
Перейти к:навигация, поиск
Строка 1: Строка 1:
 +
[[Файл:B_1.gif |link=https://bit.ly/3tbFsd6| Доступная цена]]
 +
 
=== Wordpress - Warning Cannot modify header information - headers already sent by - functions.php - решение===
 
=== Wordpress - Warning Cannot modify header information - headers already sent by - functions.php - решение===
  

Версия 08:18, 29 ноября 2022

Доступная цена

Wordpress - Warning Cannot modify header information - headers already sent by - functions.php - решение

После переноса сайта с другого хостинга - при заходе в админку wp-admin - была белая страница, а при заходе по wp-login.php - ошибка

Cookies заблокированы из-за неожиданного вывода на экран

После включения дебаг логов в wp-config.php:

define('WP_DEBUG', true);

и захода на страницу админки Wordpress через wp-login.php получили более развернутые ошибки вида:

Warning: Cannot modify header information - headers already sent by

(output started at /home/user1/public_html/wp-content/themes/dt-the7/functions.php:1) in /home/user1/public_html/wp-login.php on line 462

Warning: Cannot modify header information - headers already sent by

(output started at /home/user1/public_html/wp-content/themes/dt-the7/functions.php:1) in /home/user1/public_html/wp-login.php on line 478

Ошибка говорит, о проблеме с кодировкой в файле темы: /home/user1/public_html/wp-content/themes/dt-the7/functions.php
Для решения - достаточно через ssh через vim сохранить этот файл в кодировке UTF-8 без BOM:

:setlocal nobomb
:w ++bin
:wq

отключить дебаг в wp-config.php и зайти заново в админку со своим паролем.

Ссылка, где детально описывается проблема:

https://codex.wordpress.org/ЧАВО/Cookies_заблокированы_или_не_поддерживаются
https://iphwiki.net/wiki/Linux_-_vim_-_encoding_without_BOM