Below is a rendering of the page up to the first error wordpress

В данной статье вы узнаете почему вылетает ошибка This page contains the following errors: Below is a rendering of the page up to the first error. и как ее исправить? В моем случае эта ошибка вылетает при формировании RSS фида через плагин для Wordpress под названием Mail.ru Pulse Feed

В данной статье вы узнаете почему вылетает ошибка This page contains the following errors: Below is a rendering of the page up to the first error. и как ее исправить? В моем случае эта ошибка вылетает при формировании RSS фида через плагин для WordPress под названием Mail.ru Pulse Feed

Всем привет, я продолжаю Продвижение своего блога к вершине 10 тыс уников в сутки и сегодня я решил поставить прикрутить к блогу Майл Пульс, тем более я уже в том году туда добавился, но по какой то о причине он перестал работать и решил поднять этот канал тем более в свое время он приносил нормально трафика.

так что ловите мини заметку. на тему как победить ошибку которая вылетает при формировании RSS фида. в плагин Mail.ru Pulse Feed

This page contains the following errors:
error on line 2803 at column 36: Extra content at the end of the document
Below is a rendering of the page up to the first error.

ошибка This page contains the following errors:

После настройки плагина Mail.ru Pulse Feed  и переходе по ссылке моего фида вылетала ошибка, из текста я понял что он не может сформировать фид из-за какой то ошибки. В итоге решение пришло быстро, я отмотал в самый них файла где вычислил по тексту статью на котором перестает формироваться файл.

Найдя статью, дело остается за малым либо:

  1. по абзацам удалять код с текстом и проверять формируется ли фид
  2. смотреть инородный код и удалять его

В моем случае у меня в статье про толстяка из Little Big стоял код видео на сторонний ресурс и после его удаления все стало нормально формироваться)

ошибка при формировании фида Below is a rendering of the page up to the first error.

xml карта сайта с ошибкой

Данная проблема возникает у пользователей CMS WordPress. Бывает так что XML карта сайта созданная при помощи плагина google-sitemap-generator, отображается некорректно, а то и вовсе выдает ошибку:

This page contains the following errors:

error on line 2 at column 6: XML declaration allowed only at the start of the document
Below is a rendering of the page up to the first error.

Эта проблема решается очень легко и просто.  Все что нужно Вам сделать так это открыть файл function.php Вашей темы, который расположен в папке темы ваш_домен/wp-content/themes/ваша_тема и удалить все пустые строки и пробелы в конце файла.

function.phpСамое главное чтобы файл заканчивался не пробелом и не пустой строкой.

функции темы

Сохраните изменения и примените их. Закачав измененный файл обратно на хостинг или если Вы изменяли файл в админ панели блога, то просто нажмите на кнопку Обновить файл.

После проделанных действий Вы больше не увидите ошибку:

ошибка карты сайта

И Ваша карта сайта будет корректно отображаться и функционировать.

карта сайтаА так же можно скрыть ссылки которые отображаются выше (в голубой рамке) и ниже (серым цветом) самой карты сайта, но для этого надо знать хоть немного HTML CSS.

На этом все, думаю информация будет полезна тем кто столкнулся с данной проблемой.

Совсем недавно я делал блог под заказ. Когда дело дошло до настройки RSS-ленты, мне браузеры выдали вот такую ошибку:

в Firefox

XML Parsing Error: XML or text declaration not at start of entity
Location: https://iuliandonici.com/feed
Line Number 3, Column 1:
^

в Opera

XML declaration not at beginning of document

в Chrome

This page contains the following errors:
error on line 2 at column 6: XML declaration allowed only at the start of the document
Below is a rendering of the page up to the first error.

Чтобы найти решение проблемы, я промучился 2 часа. Но теперь я знаю, что это за ошибка, почему она возникла и как ее исправить. А, поскольку с этой ошибкой сталкиваются практически все, кто ковыряется в коде WordPress, устанавливает новые плагины, или просто развивает свой блог изнутри, то уверен, что эта информация будет полезной.

Откуда взялась ошибка с XML declaration в RSS-ленте?

При создании feed (фида) используется XML формат. XML блок должен выводится первым в ленте и без всяких пробелов спереди. Некоторые плагины делают грубую ошибку, оставляя после себя те самые ненужные пробелы, которые и ломают всю нашу RSS-ленту, с чем я и столкнулся в заказе.
Когда я открыл исходный код блога, то увидел в самом верху огромное количество пробелов. Советую и вам посмотреть на ваших ресурсах. Если вы не знаете, как посмотреть исходный код сайта в браузере, пишите в комментариях.

Откуда взялась ошибка с XML declaration в RSS-ленте?

Исправление ошибки  XML declaration в RSS-ленте.

Итак, как я исправил ошибку?
Как вы уже поняли, нужно бороться со зловещими пробелами в начале сайта. Приступим.

1). В самом начале я проверил нет ли пробелов в файле темы functions.php.
Проверять нужно до

<?php

и после

?>

Если у вас имеются пробелы, удалите.

2). Посмотрите наличие пробелов в файле wp-config.php вначале кода и в конце.

3). Проверьте файлы wp-rss2.php и wp-atom.php. Если есть пробелы в начале или в конце кода, удалите.

4). Мне этих три пункта не помогли, так как пробелов в файлах не было. Тогда я в админ-панеле стал выключать по одному плагину. И вот, совершилось!!! Я нашел виноватого. После деактивации плагина «WP No External Links» все заработало.

5).  Если  у вас ошибка и далее висит, воспользуйтесь плагином «Fix RSS Feed Word Press«. Этот плагин удаляет лишние пробелы в файлах, которые так мешают работе RSS-ленты.
Я плагин не использовал и не проверял на работоспособность. Сказать, на сколько он хорош не могу, но рекомендую, на всякий случай, сделать резервную копию полностью всего сайта, это во избежание лишних проблем, мало ли что может случиться.

6). Если вы для трансляции ленты на блоге используете Feedburner, и после всех этих исправлений он не хочет работать, сделайте такие действия:
зайдите в ваш аккаунт Feedburner => Мои фиды (My Feeds) =>нажмите на название фида =>Решение проблемы (Troubleshootize) => Resync Now. Эта операция обновит и ресинхонизирует ленту-RSS.

Если для устранения ошибки вам не помог ни один из пунктов, пишите в комментарии, попробуем разобраться вместе.

Понравился пост? Помоги другим узнать об этой статье, кликни на кнопку социальных сетей ↓↓↓

Последние новости категории:

Похожие статьи

Популярные статьи:

Добавить комментарий

Метки: RSS, wordpress

I am using XMLWriter to create xml.Below is my code which is working fine.

<?php
header("Content-Type: text/xml;");
$writer = new XMLWriter(); 
$writer->openMemory();  
$writer->startDocument('1.0'); 
$writer->setIndent(4); 
$writer->startElement('epp'); 
$writer->startElement("command"); 
$writer->startElement("login"); 
$writer->writeElement('clID', 'hello'); //username
$writer->writeElement('pw', 'abcdefg'); //password
$writer->endElement(); //login
$writer->endElement(); //command
$writer->endElement(); //login
$writer->endDocument(); 
$file =  $writer->outputMemory(true); 
echo $file;

?>

If am using below code I am getting error «Getting Error «Below is a rendering of the page up to the first error.».

<?php
$time  = time();
echo $time;
header("Content-Type: text/xml;");
$writer = new XMLWriter(); 
$writer->openMemory();  
$writer->startDocument('1.0'); 
$writer->setIndent(4); 
$writer->startElement('epp'); 
$writer->startElement("command"); 
$writer->startElement("login"); 
$writer->writeElement('clID', 'hello'); //username
$writer->writeElement('pw', 'abcdefg'); //password
$writer->endElement(); //login
$writer->endElement(); //command
$writer->endElement(); //login
$writer->endDocument(); 
$file =  $writer->outputMemory(true); 
echo $file;

?>

Error:For above block of code below is the error:I am getting this in google chrome:

 This page contains the following errors:

 error on line 1 at column 1: Document is empty
 Below is a rendering of the page up to the first error.

If I am not using header(«Content-Type: text/xml;»); then above block of code is working but time is displaying and not giving the xml format. Below is the error:

1354510317 hello abcdefg

EDIT:
In Mozilla I am getting below erro:

XML Parsing Error: not well-formed
Location: http://localhost/example.php
Line Number 1, Column 11:1354512268<?xml version="1.0"?>
 ----------^

If I have done anything wrong with my code please suggest.

How «Below is a rendering of the page up to the first error.» error can
be removed?

This page contains the following errors:

error on line 1 at column 6: XML declaration allowed only at the start of the document

Below is a rendering of the page up to the first error.

or

XML Parsing Error: XML or text declaration not at start of entity

XML declaration error in XML Sitemap

As frustrating as this is, unfortunately it’s not something that can be “fixed” in All in One SEO, and requires a bit of troubleshooting to determine what file is causing it.

If you’re getting this error, this indicates headers have already been sent, usually caused by another PHP file outputting blank lines. Normally this happens when a poorly written plugin or theme’s PHP file is incorrectly outputting a closing PHP ?> tag, followed by some extra lines.

There are three possible culprits:

  1. Another plugin – You can use these instructions to narrow down the offending plugin/plugins. Once you find the plugin, you can either deactivate it, look for the file(s) with a closing PHP tag followed by blank lines and remove it, and/or contact the developer with the bug report.
  2. Your theme – Similar to #1,  use these instructions to determine if it’s your theme that’s the problem. Install a fresh and unmodified copy of one of the default themes (Twenty Nineteen, Twenty Twenty, etc). If the problem goes away, you know it was your theme.
  3. WordPress core – This would only be a problem if either you’re on a really old version of WordPress (upgrade!) or else you’ve modified core files (don’t!).
Whitespace after the closing PHP tag

Wherever you find this closing PHP tag, remove it.

Приветствую всех вебмастеров работающих на WordPress, сегодня на блоге WebMasterMaksim.ru я хочу поделиться с вами решением любых проблем связанных с ошибками и неработоспособность rss.

WordPress не работает rss - ошибки - This page contains the following errors - Below is a rendering of the page up to the first error

WordPress не работает rss – ошибки – This page contains the following errors – Below is a rendering of the page up to the first error

Не знаю как у вас но у меня на моих блогах частенько бывает, вот такое:

WordPress не работает rss - ошибки - This page contains the following errors - Below is a rendering of the page up to the first error

This page contains the following :

error on line 2 at column 6: XML declaration allowed only at the start of the document
Below is a rendering of the page up to the first error.

И в начале жизни данного блога я столкнулся с аналогичной проблемой, но я ее быстро исправил и забыл про нее.

И вот недавно чисто случайно нажал на свою кнопку rss, и ОПЯТЬ увидел:

This page contains the following errors:
error on line 2 at column 6: XML declaration allowed only at the start of the document
Below is a rendering of the page up to the first error.

Но славу богу, решение ошибок rss wordpress у меня всегда под рукой, это плагин, который у меня отключен, и при необходимости я его активирую, захожу в его настройки и жму всего на одну кнопку “restore fix”.

После чего плагин сам исправит все ошибки вашей rss, и лента заработает, после чего просто отключаем плагин и ждем когда у нас опять перестанет работать rss.

плагин fix-rss-feed вы сможете с оф сайта WP

Все думаю, может кому пригодится эта маленькая заметка, в заключение скажу, что этот плагин лечит все ошибки rss на WordPress, не только эту!

Предыдущая

Создать блог WordPressПостраничная навигация WordPress без плагинов.

Следующая

Создать блог WordPressSeo оптимизация WordPress — плагин Seo by Yoast.

This is a common issue that crops up for active developers. All of a sudden, their sitemap.xml, sitemap_index.xml, sitemap_posts.xml, etc.. seemingly just stops working — outputting this error:

This page contains the following errors: error on line 2 at column 6: XML declaration allowed only at the start of the document. Below is a rendering of the page up to the first error.

What’s going on?

In short, there’s most likely an empty line at the top of the page source. Go ahead and right-click on the sitemap page, then View Page Source. You’ll probably see something like this:

Notice how the code begins on line 2 — and not line 1 (as it should). That simple empty line is breaking the XML syntax. So where did it come from?

Probable causes:

  • An empty line at the top of wp-config.php
  • An empty line at the end of your theme functions.php
  • An empty line or line break anywhere before or after <?php and ?> opening/closing tags (generally plugins or theme files)

Let’s narrow things down.

Troubleshooting: The Active Theme

The first thing to do is switch your theme to a default one (ie. twentynineteen) — it’s possible your theme developer released an update accidentally including a line break or empty space. I’ve also been guilty of causing this myself numerous times when adding custom lines to my theme’s functions.php.

Clear out any caches you might have enabled (Autoptimize, WP-Rocket, Cloudflare, etc). and refresh the page. Once you confirm the default theme is loading, refresh the sitemap page and inspect the source code to see if the empty line is still there. If it is, it’s not your theme — let’s move on to plugins.

Troubleshooting: Active Plugins

You could deactivate each plugin, one by one — refreshing the page each time to see if empty line disappears. But to speed things along, let’s start by confirming the issue is coming from one of the plugins at all.

Rather than disabling all plugins, and enabling one by one — we’re going to add a PHP snippet to pseudo-deactivate them all without letting the plugins know. This is a big time saver because there are a bunch of plugins that remove their data from the database automatically on deactivation and need to be reconfigured if they’re switched off and on again (ie. Jetpack).

Open your FTP client (ie. Filezilla) or SSH to your site with your terminal and make a file called /wp-content/mu-plugins/plugin-sleep.php. If you don’t already have an /mu-plugins/ directory, make one (WordPress autoloads any plugins in this location).

Paste this code into the plugin-sleep.php file you made:

<?php
// Deactivate all plugins without loosing their configurations
add_filter('pre_option_active_plugins', '__return_empty_array');
add_filter('pre_site_option_active_sitewide_plugins', '__return_empty_array');

After this, reload the site. The plugins should all register as deactivated. The odds are you’re using a plugin like Yoast to generate your sitemap.xml, but that’s deactivated now so the sitemap page will 404. No matter! The empty line should appear at top of any page (including the WordPress 404 page). View the page source again to see if the empty line is still there.

If it’s gone, great. You know it’s a plugin. Remove /wp-content/mu-plugins/plugin-sleep.php and proceed with toggling the plugins off and one, one by one until you find your culprit.

Troubleshooting: Must Use Plugins

This step may not apply to you. If you already had an /mu-plugins/ directory and there were other php files in there, try renaming the directory altogether (something like /disable-mu/). This will stop WordPress from automatically loading them. Refresh the page to see If the empty line was coming from one of the files in there.

If the empty line is still there, rename it back to /mu-plugins/.

At this point, it’s most likely your wp-config.php or some other WordPress core file.

Troubleshooting: WordPress Core

The next place to stop off is your wp-config.php. Are there any empty lines outside of the <?php and ?> tags? Here’s what it might look like:

[SOLVED] Broken Sitemap.xml: Error line 2 at column 6

Notice that line 1 is empty and the <?php opening tag is on line 2? Remove that empty line then refresh the page and view the page source to see if that did the trick.

Troubleshooting: Search all files for empty start/end lines

If you want to search and print a list of all PHP files that begin with an arbitrary empty line, SSH into your site and run this in your terminal:

find . -name "*.php" -type f -size +0 -exec gawk 'STARTFILE{if ($0 == "") print FILENAME}' {} +

If you want to search and print a list of all PHP files that end with an arbitrary empty line, SSH into your site and run this in your terminal:

find . -name "*.php" -type f -size +0 -exec gawk 'FNR==1{if ($0 == "") print FILENAME}' {} +

These commands will help narrow down specific files that contain arbitrary empty lines at the start and end of each file. They won’t find any in the middle of the code though. Though if you’ve gone through all the steps above and are still seeing the issue — it’s not the plugin/theme or WordPress core code — so at least you’ve narrowed it down to some kind of custom script.


CMS, WordPress

  • 26.10.2016
  • 4 605
  • 3
  • 11.09.2022
  • 3
  • 3
  • 0

XML declaration allowed only at the start of the document

  • Содержание статьи
    • Описание
    • Комментарии к статье ( 3 шт )
    • Добавить комментарий

В данной статье пойдет речь о том, как исправить ошибку «XML declaration allowed only at the start of the document», которая может появляться в некоторых случаях при переносе сайта на новый хостинг.

Описание

Перенося один из своих сайтов на новый хостинг, я однажды столкнулся с проблемой, что вместо нормальной карты сайта, генерируемой движком вордпресса, вылезло окно с ошибкой:

This page contains the following errors:
error on line 2 at column 6: XML declaration allowed only at the start of the document
Below is a rendering of the page up to the first error.

wordpess-error
После гугления обнаружилось, что одной из причин такой ошибки может быть наличие разных символов/пробела/переноса строки в первой строке php файлов текущей темы оформления для WordPress. Переходим к поиску злоумышленника!
Для рекурсивного поиска всех php файлов в директории и отображения только тех, где первая строчка начинается не с <?php я наваял вот такую последовательность команд:

find /srv/www/pc.ru/wp-content/themes/sysadmin/ -type f -name '*.php' -exec grep -Hnm1 '' {} ;| grep -v ':1:<?php'

find /srv/www/pc.ru/wp-content/themes/sysadmin/ -type f -name '*.php' — Поиск всех php файлов в директории /srv/www/pc.ru/wp-content/themes/sysadmin/
-exec grep -Hnm1 '' {} ; — Для каждого файла запускаем grep. Параметр H — отображает название текущего файла, n — отображает номер строки, m1 — останавливает поиск после первого же совпадения, » — пустое условие поиска. Таким образом мы из каждого файла берем только первую строку, а также в ней оставляем название файла и номер этой самой строки.
grep -v ':1:<?php' — Параметр v — означает инверсию, т.е. выводит только то, что не совпадает с условием поиска ‘:1:<?php’ В результате выполнения, данная последовательность команд выведет список всех php файлов в директории, первая строчка которых НЕ НАЧИНАЕТСЯ с символов «<?php». Далее остается только отредактировать найденные файлы и убрать из них мусор. В моем случае оказалось, что проблема была из-за невнимательного редактирования — один из файлов темы начинался с символа переноса строки.

Понравилась статья? Поделить с друзьями:
  • Bind failed with error 10048 beam mp
  • Bind error dumping master file
  • Bind error 10013 сделана попытка доступа к сокету методом запрещенным правами доступа
  • Bind error 10013 tftpd64
  • Bind error 10013 tftpd