Title: Inline script breaks XML sitemap
Last modified: July 5, 2018

---

# Inline script breaks XML sitemap

 *  [Clement Gonnet](https://wordpress.org/support/users/renoovodesign/)
 * (@renoovodesign)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/inline-script-breaks-xml-sitemap/)
 * I’ve noticed your plugin echoes a script at the top of any page when the shortcode
   is being used.
    There is an issue with Yoast SEO XML Sitemap with pages using
   your shortcode. It adds the inline script outside of the WordPress normal method.
 * So when viewing page-sitemap.xml I get an error saying the sitemap is invalid,
   because xml files should never have any javascript running.
 *     ```
       This page contains the following errors:
       error on line 11 at column 7: XML declaration allowed only at the start of the document
       Below is a rendering of the page up to the first error.
       jQuery(document).ready(function(){ jQuery("#fcywctax.rotate-text").textrotator({ animation: "spin", separator: "|", speed: 10000 }); });
       ```
   
 * Here is my fix in file saeid-text-rotator.php:43
 *     ```
       //echo $rotatejquery;
       wp_add_inline_script( 'saeidrotate-inline-script', $rotatejquery );
       ```
   
    -  This topic was modified 7 years, 11 months ago by [Clement Gonnet](https://wordpress.org/support/users/renoovodesign/).
    -  This topic was modified 7 years, 11 months ago by [Clement Gonnet](https://wordpress.org/support/users/renoovodesign/).

Viewing 1 replies (of 1 total)

 *  Thread Starter [Clement Gonnet](https://wordpress.org/support/users/renoovodesign/)
 * (@renoovodesign)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/inline-script-breaks-xml-sitemap/#post-10465932)
 * Unfortunately, the fix doesn’t do the job. It takes a while to test it because
   the sitemap isn’t regenerating ad hoc but when Yoast wants to.
    Explanation found
   here: [https://wordpress.stackexchange.com/questions/235905/how-to-add-inline-css-js-inside-a-shortcode](https://wordpress.stackexchange.com/questions/235905/how-to-add-inline-css-js-inside-a-shortcode)
 * I’ve tried also adding `!is_feed()` before the shortcode is rendered, but that
   doesn’t seem to work either.
 * Author, can we have some help here?

Viewing 1 replies (of 1 total)

The topic ‘Inline script breaks XML sitemap’ 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

 * [script](https://wordpress.org/support/topic-tag/script/)
 * [sitemap](https://wordpress.org/support/topic-tag/sitemap/)
 * [xml](https://wordpress.org/support/topic-tag/xml/)
 * [Yoast](https://wordpress.org/support/topic-tag/yoast/)

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