WPIntell

Source evidence

Inline script breaks XML sitemap

Saeid Simple Text Rotator · support · 2018-07-05T12:19:00+00:00

complaintsentiment
mediumseverity
0.87relevance
1replies
Evidence onlycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

1 / 1 rows with source links

100.0% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

0 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
Clement Gonnet unresolved
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, 10 months ago by Clement Gonnet . This topic was modified 7 years, 10 months ago by Clement Gonnet . 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 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?

Comments

1 shown
Clement Gonnet 2018-07-05T13:42:00+00:00

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 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?