Title: Unexpected behavior with &#8216;Exclude Scripts&#8217; in Optimize JS
Last modified: March 19, 2024

---

# Unexpected behavior with ‘Exclude Scripts’ in Optimize JS

 *  [zendev](https://wordpress.org/support/users/zendev/)
 * (@zendev)
 * [2 years ago](https://wordpress.org/support/topic/unexpected-behavior-with-exclude-scripts-in-optimize-js/)
 * The setting found in “Optimize JS” -> “Optimize JS” -> “Exclude Scripts” – I’m
   not sure if this is doing what it’s supposed to do. The text under the box says“
   Enter one per line to exclude certain JS files from being deferred.”
 * So does this mean that any script listed here should remain in it’s original 
   location in the raw HTML, rather than be moved to the footer?
 * ![](https://wordpress.org/07240170-a83e-46a7-845d-ea83361bd680)
 * When I enter the path of one of my custom .js files in this box, it’s totally
   removed from the entire site. My custom script itself is inserted in functions.
   php with:
 *     ```wp-block-code
       wp_enqueue_script('ajax-js', get_stylesheet_directory_uri() . '/js/ajax-location-2.js', array('jquery'), null, true);
       ```
   
 * I don’t think other scripts are being removed, so what is going on?

The topic ‘Unexpected behavior with ‘Exclude Scripts’ in Optimize JS’ is closed 
to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/debloat.svg)
 * [Debloat - Remove Unused CSS, Optimize JS](https://wordpress.org/plugins/debloat/)
 * [Support Threads](https://wordpress.org/support/plugin/debloat/)
 * [Active Topics](https://wordpress.org/support/plugin/debloat/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/debloat/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/debloat/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [zendev](https://wordpress.org/support/users/zendev/)
 * Last activity: [2 years ago](https://wordpress.org/support/topic/unexpected-behavior-with-exclude-scripts-in-optimize-js/)
 * Status: not resolved