XML declaration allowed only at the start of the document issue

Posted in: Newspaper
Post count: 74

https://conexionmas.com/sitemap_index.xml show me that error, if deactivate your template sitemap for google console works correctly, something about php of your template:

https://goo.gl/HWdSTW

Stay alert

Post count: 20688

Hi,

You could try some suggestions from these topics
https://wordpress.org/support/topic/sitemap-error-error-on-line-2-at-column-6-xml-declaration-allowed-only-at-the/
https://kb.yoast.com/kb/xml-sitemap-error/
https://premium.wpmudev.org/forums/topic/error-on-line-3-at-column-6-xml-declaration-allowed-only-at-the-start-of-the-document-below-is-a-re
They mention empty spaces in the wp-config.php or functions.php file (theme and child theme if used) check that.
For me there is no problem, default theme and plugins, and latest Yoast plugin
https://www.screencast.com/t/nrIAfkhb

Post count: 74

in wp-content/themes/Newspaper/functions.php
i view this:

function td_on_get_footer() {
if ( is_user_logged_in() && ! td_util::tdc_is_live_editor_iframe() && td_util::get_check_installed_plugins() ) {

ob_start();
?>
<script>

setTimeout(function () {

confirm( "Did you disable any TagDiv plugins? \nWe've got some errors at loading API files. It could happen because of a disabled TagDiv plugin!");

}, 3000);

</script>
<?php
echo ob_get_clean();
}
}

if comment
ob_start();
/*?>*/
works, how can write that section correctly?

Post count: 20688

That would be the default code in the theme functions file, for me it is the same
https://www.screencast.com/t/bsP7zr0R
The sitemap works for me with that code as shown above. So there would be no need to comment any code in the file.

Seems that if I add a space at the top of the functions file
https://www.screencast.com/t/fChYLo0zB
I get that error – https://www.screencast.com/t/BCcF5eEgtaG
But with a default functions file the sitemap works.

Viewing 4 posts - 1 through 4 (of 4 total)
The forum ‘Newspaper’ is closed to new topics and replies.