# Wordpress popup form not working

**URL:** <https://community.hubspot.com/t/wordpress-popup-form-not-working/27520>\
**Category:** APIs & Integrations\
**Tags:** forms\
**Created:** [November 3, 2020, 12:12am UTC](https://community.hubspot.com/t/wordpress-popup-form-not-working/27520 "2020-11-03T00:12:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![techFA](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/techfa/32/87988_2.png) [@techFA](https://community.hubspot.com/u/techFA)\
**Post date:** [November 3, 2020, 12:12am UTC](https://community.hubspot.com/t/wordpress-popup-form-not-working/27520/1 "2020-11-03T00:12:31Z")

</div>

Hi, I need help integrating my form into my wordpress page, I am creating a popup with the embedded form code, but everytime I try it gives me this error:

TypeError: hbspt.forms.create is not a function

I tried inserting the script into the header but no success.

Here is the popup HTML

\<div id=“ppsPopupShell\_[ID]” class=“ppsPopupShell ppsPopupListsShell”\>  
\<a href=“#” class=“ppsPopupClose ppsPopupClose\_[close\_btn]”\>\</a\>  
\<div class=“ppsInnerTblContent”\>  
\<div class=“ppsPopupListsInner ppsPopupInner”\>  
\<div class=“ppsPopupLabel ppsPopupListsLabel”\>[label]\</div\>  
\<div style=“clear: both;”\>\</div\>

\<script\>  
hbspt.forms.create({  
portalId: “xxxxxxx”,  
formId: “xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx”  
});  
\</script\>  
\<div style=“clear: both;”\>\</div\>  
\</div\>  
\</div\>  
\</div\>

I am using a button to display the popup, everytime I remove the embedded code it loads just fine, but when I reinsert it, it just crashes.

---

<div class="post-metadata">

**Author:** ![Mike\_Eastwood](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mike_eastwood/32/70075_2.png) [@Mike\_Eastwood](https://community.hubspot.com/u/Mike_Eastwood)\
**Post date:** [November 4, 2020, 3:41am UTC](https://community.hubspot.com/t/wordpress-popup-form-not-working/27520/2 "2020-11-04T03:41:49Z")

</div>

Hi @techFA

Looks to me like your Embed Code is firing before your HubSpot Javascript is loaded.

Assuming you’ve installed the HubSpot Plugin and there are no serious Javascript errors on the page.

I would try this:

```lia-code-sample
...
<script>
window.onload = function() {
 hbspt.forms.create({
 portalId: "xxxxxxx",
 formId: "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx"
 });
}
</script>
...

```

And, to be safe, I’d add a Target Div ID.

Have a look at this page:

> **[\[UPDATED\] HubSpot CMS Design Tips – Forms](https://www.webalite.com/blog/hubspot-cos-design-tips-forms)**
>
> \[UPDATED\] HubSpot CMS Design tips to optimise the User Experience (UX) when integrating HubSpot forms into your website (works in WordPress too).

Have fun

Mike

---

<div class="post-metadata">

**Author:** ![techFA](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/techfa/32/87988_2.png) [@techFA](https://community.hubspot.com/u/techFA)\
**Post date:** [November 4, 2020, 5:28pm UTC](https://community.hubspot.com/t/wordpress-popup-form-not-working/27520/3 "2020-11-04T17:28:08Z")

</div>

Thank you very much. It did work fine.
