You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.
@olefredrik I just setup Yost SEO on a new site and when I tried to view the sitemap.xml file I was getting the following error I'd never experienced before.
error on line 2 at column 6: XML declaration allowed only at the start of the document
I know modern the modern standard is to generally not even have the closing php tag on files, and even after adding one to my functions.php file I was still getting this error.
Then I checked through all the included library files. Some have no closing tags, some have closing tags with trailing whitespace.
I made sure all those files in the library file had a closing php tag ?> and no whitespace or new lines following that tag.
That fixed the error with auto generated sitemap.xml files.
From what I read this is not a Yost SEO issue, but will affect all auto generated wordpress sitemap.xml files. Also note this is a FP5 site.
The text was updated successfully, but these errors were encountered:
If a file is pure PHP code, it is preferable to omit the PHP closing tag at the end of the file. This prevents accidental whitespace or new lines being added after the PHP closing tag, which may cause unwanted effects because PHP will start output buffering when there is no intention from the programmer to send any output at that point in the script.
As I see it, this is a Yoast SEO plugin issue and not a FoundationPress issue? I just installed the popular XML Sitemap Generator for WordPress and managed to generate sitemaps without problems.
@olefredrik I just setup Yost SEO on a new site and when I tried to view the sitemap.xml file I was getting the following error I'd never experienced before.
error on line 2 at column 6: XML declaration allowed only at the start of the document
A little googling led to a few threads like the following that all mention you should have no trailing whitespace after the closing php tag in your functions.php file
https://wordpress.org/support/topic/yoast-seo-xml-sitemap-error
I know modern the modern standard is to generally not even have the closing php tag on files, and even after adding one to my functions.php file I was still getting this error.
Then I checked through all the included library files. Some have no closing tags, some have closing tags with trailing whitespace.
I made sure all those files in the library file had a closing php tag
?>
and no whitespace or new lines following that tag.That fixed the error with auto generated sitemap.xml files.
From what I read this is not a Yost SEO issue, but will affect all auto generated wordpress sitemap.xml files. Also note this is a FP5 site.
The text was updated successfully, but these errors were encountered: