Title: Inline script breaks XML Sitemap (2)
Last modified: March 5, 2019

---

# Inline script breaks XML Sitemap (2)

 *  [Clement Gonnet](https://wordpress.org/support/users/renoovodesign/)
 * (@renoovodesign)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/inline-script-breaks-xml-sitemap-2/)
 * To follow up on the previous issue [reported here](https://wordpress.org/support/topic/inline-script-breaks-xml-sitemap/).
   I would like to share a suggestion.
 * To recap, I use Yoast SEO. The XML sitemap /page-sitemap.xml has extra jQuery
   added at the top of the xml file, which breaks the page. Google Search Console
   reports:
    _Unsupported file format – Your Sitemap does not appear to be in a 
   supported format. Please ensure that it meets our Sitemap guidelines and resubmit._
   When I turn off your plugin, the issue is fixed.
 * The sitemap xml file looks like this:
 *     ```
       	<script>
       	jQuery(document).ready(function(){
       		jQuery("#mwtxmtlv.rotate-text").textrotator({
       			animation: "spin",
       			separator: "|",
       			speed: 10000
       		});
       	});
       	</script>
       	<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="//www.ergo3.co.uk/wp-content/plugins/wordpress-seo/css/main-sitemap.xsl"?>
       <urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd http://www.google.com/schemas/sitemap-image/1.1 http://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
       ```
   
 * I have discovered that the shortcode ‘saeidrotate’ is instructed to ‘echo’ an
   inline js script. This is wrong practice as it breaks the WordPress loops. Instead
   of using ‘echo’, I recommend returning the script as part of the shortcode function.
 * So instead of:
    `echo $rotatejquery;` use `return $rotatejquery.'<span id="'.
   $id.'" class="'.$class.'">'.do_shortcode($content).'</span>';`
 * This has fixed the problem.
    Author, it would be a good idea to implement this
   in your code if this solution is approved.

The topic ‘Inline script breaks XML Sitemap (2)’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/saeid-simple-text-rotator.svg)
 * [Saeid Simple Text Rotator](https://wordpress.org/plugins/saeid-simple-text-rotator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/saeid-simple-text-rotator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/saeid-simple-text-rotator/)
 * [Active Topics](https://wordpress.org/support/plugin/saeid-simple-text-rotator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/saeid-simple-text-rotator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/saeid-simple-text-rotator/reviews/)

## Tags

 * [break](https://wordpress.org/support/topic-tag/break/)
 * [jquery](https://wordpress.org/support/topic-tag/jquery/)
 * [sitemap](https://wordpress.org/support/topic-tag/sitemap/)
 * [xml](https://wordpress.org/support/topic-tag/xml/)

 * 0 replies
 * 1 participant
 * Last reply from: [Clement Gonnet](https://wordpress.org/support/users/renoovodesign/)
 * Last activity: [7 years, 3 months ago](https://wordpress.org/support/topic/inline-script-breaks-xml-sitemap-2/)
 * Status: not resolved