Title: Remove type=&#8221;text/javascript&#8221; in Jetpack scripts
Last modified: February 10, 2018

---

# Remove type=”text/javascript” in Jetpack scripts

 *  Resolved [icezorg](https://wordpress.org/support/users/icezorg/)
 * (@icezorg)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/remove-typetext-javascript-in-jetpack-scripts/)
 * I have these errors in W3c validator: “The type attribute is unnecessary for 
   JavaScript resources.”
 * I want to remove the type=”text/javascript” in the script generated by Jetpack.
 * I already have these codes placed in the functions.php, but unfortunately its
   not enough.
 * add_filter(‘style_loader_tag’, ‘codeless_remove_type_attr’, 10, 2);
    add_filter(‘
   script_loader_tag’, ‘codeless_remove_type_attr’, 10, 2); function codeless_remove_type_attr(
   $tag, $handle) { return preg_replace( “/type=[‘\”]text\/(javascript|css)[‘\”]/”,”,
   $tag ); }

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [pmciano](https://wordpress.org/support/users/pmciano/)
 * (@pmciano)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/remove-typetext-javascript-in-jetpack-scripts/#post-9960171)
 * > I have these errors in W3c validator
 * Are these _errors_ or _warnings_?
 * What is the address of the site/page in question?
 * Once you give us some additional clarification, we will be more than happy to
   continue addressing your issue.
 *  Thread Starter [icezorg](https://wordpress.org/support/users/icezorg/)
 * (@icezorg)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/remove-typetext-javascript-in-jetpack-scripts/#post-9960285)
 * im sorry, those were not errors but “warnings” only. i just want my pages to 
   be perfect.
 * please take a look
    [https://validator.w3.org/nu/?doc=https%3A%2F%2Fnews.txtbuff.com%2Fpay-sss-contributions-and-loans-using-gcash%2F](https://validator.w3.org/nu/?doc=https%3A%2F%2Fnews.txtbuff.com%2Fpay-sss-contributions-and-loans-using-gcash%2F)
 *  [pmciano](https://wordpress.org/support/users/pmciano/)
 * (@pmciano)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/remove-typetext-javascript-in-jetpack-scripts/#post-9962393)
 * WordPress itself is responsible for this, and an issue has already been opened
   about your concern.
 * You can follow along here:
 * [https://core.trac.wordpress.org/ticket/42804](https://core.trac.wordpress.org/ticket/42804)
 * If you have additional questions, please let us know!
 *  Thread Starter [icezorg](https://wordpress.org/support/users/icezorg/)
 * (@icezorg)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/remove-typetext-javascript-in-jetpack-scripts/#post-9985213)
 * The following scripts are generated by Jetpack, not WordPress.
 *     ```
       <script type='text/javascript'>
       /* <![CDATA[ */
       var related_posts_js_options = {"post_heading":"h4"};
       /* ]]> */
       </script>
       ```
   
 *     ```
       <!--[if IE]>
       <script type="text/javascript">
       	if ( 0 === window.location.hash.indexOf( '#comment-' ) ) {
       		// window.location.reload() doesn't respect the Hash in IE
       		window.location.hash = window.location.hash;
       	}
       </script>
       <![endif]-->
       ```
   
 *     ```
       <script type="text/javascript">
       	(function () {
       		var comm_par_el = document.getElementById( 'comment_parent' ),
       			comm_par = ( comm_par_el && comm_par_el.value ) ? comm_par_el.value : '',
       			frame = document.getElementById( 'jetpack_remote_comment' ),
       			tellFrameNewParent;
       ```
   
 * Is there a way I can remove the type=”text/javascript” in the script generated
   by Jetpack? Thanks.
 *  Plugin Author [Jeremy Herve](https://wordpress.org/support/users/jeherve/)
 * (@jeherve)
 * Jetpack Mechanic 🚀
 * [8 years, 3 months ago](https://wordpress.org/support/topic/remove-typetext-javascript-in-jetpack-scripts/#post-9995285)
 * > Is there a way I can remove the type=”text/javascript” in the script generated
   > by Jetpack?
 * I’m afraid that won’t be possible. Jetpack itself does not add that part; All
   our scripts are enqueued using core WordPress functions. `type=”text/javascript”`
   is automatically added by WordPress when the file is enqueued.
 * As a result, there isn’t much we can do to solve this. That also means that once
   [the Core issue](https://core.trac.wordpress.org/ticket/42804) my colleague mentioned
   earlier gets solved in WordPress, the fix will apply to all enqueues in WordPress,
   including those made by Jetpack.
 * I hope this clarifies things a bit.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Remove type=”text/javascript” in Jetpack scripts’ is closed to new replies.

 * ![](https://ps.w.org/jetpack/assets/icon.svg?rev=2819237)
 * [Jetpack - WP Security, Backup, Speed, & Growth](https://wordpress.org/plugins/jetpack/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/jetpack/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/jetpack/)
 * [Active Topics](https://wordpress.org/support/plugin/jetpack/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/jetpack/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/jetpack/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [Jeremy Herve](https://wordpress.org/support/users/jeherve/)
 * Last activity: [8 years, 3 months ago](https://wordpress.org/support/topic/remove-typetext-javascript-in-jetpack-scripts/#post-9995285)
 * Status: resolved