# Wordpress Enqueue Scripts Broken

**URL:** https://forum.pinegrow.com/t/wordpress-enqueue-scripts-broken/3812
**Category:** Bug Reports
**Created:** [February 27, 2020, 4:55am UTC](https://forum.pinegrow.com/t/wordpress-enqueue-scripts-broken/3812 "2020-02-27T04:55:58Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![KodMi](https://avatars.discourse-cdn.com/v4/letter/k/82dd89/32.png) [@KodMi](https://forum.pinegrow.com/u/KodMi)
#### Post date: [February 27, 2020, 4:55am UTC](https://forum.pinegrow.com/t/wordpress-enqueue-scripts-broken/3812/1 "2020-02-27T04:55:58Z")

</div>

The Problem:  
When you export/rebuild function.php after adding a wordpress action “enqueue script”.  
The script disappears from function.php

The code that disappears:

```auto
wp_deregister_script( 'popper' );
wp_enqueue_script( 'popper', get_template_directory_uri() . '/assets/js/popper.js', false, null, true);
```

The function.php file would be

```auto
  /* Pinegrow generated Enqueue Scripts Begin */

/* Pinegrow generated Enqueue Scripts End */
```

Code that causes the problem:

```auto
<script src="assets/js/popper.js" wp-enqueue-script></script>
```

If you remove “wp-enqueue-script” it will return back to the function.php file. The problem still exist even if you add “Deregister” or “Register” calls from the action tab or if you even give it a “handle”.

The “Enqueue Admin” action still gets added, seem to be only from the “website” side. That if you set it to 'admin" or “website+admin” from the “locate” drop down.

I was able to reproduce this bug every single time. No matter if it was a brand new project, or if I loaded a fresh copy of the ST2 Theme you provide.

---

<div class="post-metadata">

### Author: ![matjaz](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/matjaz/32/5_2.png) [@matjaz](https://forum.pinegrow.com/u/matjaz)
#### Post date: [February 27, 2020, 10:06pm UTC](https://forum.pinegrow.com/t/wordpress-enqueue-scripts-broken/3812/2 "2020-02-27T22:06:56Z")

</div>

@KodMi thanks for the bug report. We’ll be releasing the fix very soon.

For now, a workaround is to add this attribute to the element that has Enqueue Script action:

```
wp-enqueue-script-location="_website"
```

---

<div class="post-metadata">

### Author: ![KodMi](https://avatars.discourse-cdn.com/v4/letter/k/82dd89/32.png) [@KodMi](https://forum.pinegrow.com/u/KodMi)
#### Post date: [March 4, 2020, 1:44am UTC](https://forum.pinegrow.com/t/wordpress-enqueue-scripts-broken/3812/3 "2020-03-04T01:44:21Z")

</div>

Working as expected after the update.
