# How to remove an enqueued script that I can't find on any of my pages from functions.php? / How to edit functions.php?

**URL:** <https://forum.pinegrow.com/t/how-to-remove-an-enqueued-script-that-i-cant-find-on-any-of-my-pages-from-functions-php-how-to-edit-functions-php/8775>\
**Category:** Questions\
**Tags:** wordpress\
**Created:** [March 13, 2024, 12:54pm UTC](https://forum.pinegrow.com/t/how-to-remove-an-enqueued-script-that-i-cant-find-on-any-of-my-pages-from-functions-php-how-to-edit-functions-php/8775 "2024-03-13T12:54:52Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![iamkeef](https://avatars.discourse-cdn.com/v4/letter/i/b9e5f3/32.png) [@iamkeef](https://forum.pinegrow.com/u/iamkeef)\
**Post date:** [March 15, 2024, 9:04am UTC](https://forum.pinegrow.com/t/how-to-remove-an-enqueued-script-that-i-cant-find-on-any-of-my-pages-from-functions-php-how-to-edit-functions-php/8775/21 "2024-03-15T09:04:28Z")

</div>

can you explain what it was (just in case I might make the same mistake in the future!) thanks 🙂

---

<div class="post-metadata">

**Author:** ![Adryan](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Adryan](https://forum.pinegrow.com/u/Adryan)\
**Post date:** [March 15, 2024, 9:40am UTC](https://forum.pinegrow.com/t/how-to-remove-an-enqueued-script-that-i-cant-find-on-any-of-my-pages-from-functions-php-how-to-edit-functions-php/8775/22 "2024-03-15T09:40:34Z")

</div>

I highly doubt anyone will do that, but here it is: I’ve been testing some JS scripts and for some reason this one script I was testing on my 404 page. When I was searching for this script throughout the site, I somehow missed this one page. I’m still not sure why it was enqueued in functions.php, but I just deleted the code from 404 page and all is good now.

---

<div class="post-metadata">

**Author:** ![iamkeef](https://avatars.discourse-cdn.com/v4/letter/i/b9e5f3/32.png) [@iamkeef](https://forum.pinegrow.com/u/iamkeef)\
**Post date:** [March 15, 2024, 9:58am UTC](https://forum.pinegrow.com/t/how-to-remove-an-enqueued-script-that-i-cant-find-on-any-of-my-pages-from-functions-php-how-to-edit-functions-php/8775/23 "2024-03-15T09:58:48Z")

</div>

cool - thanks for explaining - you never know when someone (like me) might make the exact same strange mistake - I have a habit of making such strange mistakes myself haha. Thanks again

---

<div class="post-metadata">

**Author:** ![Emmanuel](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/emmanuel/32/6294_2.png) [@Emmanuel](https://forum.pinegrow.com/u/Emmanuel)\
**Post date:** [March 15, 2024, 9:59am UTC](https://forum.pinegrow.com/t/how-to-remove-an-enqueued-script-that-i-cant-find-on-any-of-my-pages-from-functions-php-how-to-edit-functions-php/8775/24 "2024-03-15T09:59:22Z")

</div>

@Adryan I have to admit that in this type of investigation, it was more convenient for me to review your files from the comfort of the desktop application. Glad I could help you.

For the rest, a good way to clearly define your document is to use the **site content** action to define by yourself what should be included as the main content of the template and what should be left to the master page. (for the scripts for example)

This way, you will not forget what’s in the header/footer of your documents (as the master page will prevail) and even if you fail, forgotten scripts added outside of the site content of any template using the master page will not be added to the functions.php file during the export.

On this topic, here is an interesting read:

> **[Introduction to the WordPress template structure - Headers, Footers, Site...](https://pinegrow.com/docs/wordpress/wordpress-template-structure-header-footer-content-master-pages/)**
>
> Looking at the WordPress theme projects created with Pinegrow or Pinegrow Theme Converter and submitted for review to our technical support, we have discovered that the very useful Site content action/

---

<div class="post-metadata">

**Author:** ![Emmanuel](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/emmanuel/32/6294_2.png) [@Emmanuel](https://forum.pinegrow.com/u/Emmanuel)\
**Post date:** [March 15, 2024, 10:15am UTC](https://forum.pinegrow.com/t/how-to-remove-an-enqueued-script-that-i-cant-find-on-any-of-my-pages-from-functions-php-how-to-edit-functions-php/8775/25 "2024-03-15T10:15:06Z")

</div>

Closed on March 15, 2024, 10:15am UTC



---

<div class="post-metadata">

**Author:** ![TechAkayy](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@TechAkayy](https://forum.pinegrow.com/u/TechAkayy)\
**Post date:** [March 15, 2024, 12:25pm UTC](https://forum.pinegrow.com/t/how-to-remove-an-enqueued-script-that-i-cant-find-on-any-of-my-pages-from-functions-php-how-to-edit-functions-php/8775/26 "2024-03-15T12:25:13Z")

</div>

> [@Adryan](#):
>
> I’m still not sure why it was enqueued in functions.php

I just wanted to call out the reason behind why it was enqueued.

Inline scripts are automatically enqueued. For eg,

```auto
<script>
console.log(''foo")
</script>

```

When exporting the theme/plugin, the functions.php will include the above script tag like this (automatically):

```auto
    wp_register_script( 'inline-script-1', '', [], '1.0.6', false );
    wp_enqueue_script( 'inline-script-1' );
    wp_add_inline_script( 'inline-script-1', 'console.log(\'foo\')');

```

When the script tag is removed, the same is removed off functions.php (automatically).

---

<div class="post-metadata">

**Author:** ![Emmanuel](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/emmanuel/32/6294_2.png) [@Emmanuel](https://forum.pinegrow.com/u/Emmanuel)\
**Post date:** [March 15, 2024, 1:13pm UTC](https://forum.pinegrow.com/t/how-to-remove-an-enqueued-script-that-i-cant-find-on-any-of-my-pages-from-functions-php-how-to-edit-functions-php/8775/27 "2024-03-15T13:13:26Z")

</div>

Indeed @TechAkayy, thank you for that final clarification.

As a matter of fact, we have documentation on this topic:

> **[Including Scripts and Styles | Pinegrow Web Editor](https://pinegrow.com/docs/wordpress/enqueue-scripts-and-styles/)**
>
> Controlling how script and style resources are included into exported WordPress theme.

[Previous page](https://forum.pinegrow.com/t/how-to-remove-an-enqueued-script-that-i-cant-find-on-any-of-my-pages-from-functions-php-how-to-edit-functions-php/8775.md?page=1)
