Body: <p>CiviCRM: 5.64</p>
  <p>CMS: WordPress 6.3</p>
  <p>I created a simple form in Form Builder and am hoping to embed it in a WordPress page. I also gave the form a standalone page for testing, and the form works well there. My CiviCRM base page is &quot;/action&quot;, and the standalone form works well when I try out: <a href="https://staging.example.org/action/test" rel="nofollow noreferrer">https://staging.example.org/action/test</a></p>
  <p>However, when I try to embed the form using a shortcode [civicrm component=&quot;afform&quot; name=&quot;afformTest&quot;], the form fails to display.  I am trying to embed the form in a page at <a href="https://staging.example.org/subscribe" rel="nofollow noreferrer">https://staging.example.org/subscribe</a>.  I dove into the source code comparing both pages, and it looks like there are two CiviCRM scripts that fail to load on that /subscribe page.  Both are trying to load using a script URL that starts with the page I am trying to embed the form on:</p>
  <pre><code>&lt;script type=&quot;text/javascript&quot; src=&quot;https://staging.example.org/subscribe/?civiwp=CiviCRM&amp;q=civicrm%2Fasset%2Fbuilder&amp;an=crm-l10n.js&amp;ad=04f82ebde2d47986edf159986efd3f87&amp;aj=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImtpZCI6IjI3Qk1SZzFHek1sUF82VnJHT0hjbDlUcER5cyJ9.eyJhc3NldCI6WyJjcm0tbDEwbi5qcyIseyJjaWQiOjAsImluY2x1ZGVFbWFpbEluTmFtZSI6dHJ1ZSwiYWpheFBvcHVwc0VuYWJsZWQiOnRydWUsImFsbG93QWxlcnRBdXRvZGlzbWlzc2FsIjp0cnVlLCJyZXNvdXJjZUNhY2hlQ29kZSI6IlhobjAxZW5fVVMiLCJsb2NhbGUiOiJlbl9VUyIsImxjTWVzc2FnZXMiOiJlbl9VUyIsImRhdGVJbnB1dEZvcm1hdCI6Im1tXC9kZFwveXkiLCJ0aW1lSW5wdXRGb3JtYXQiOjEsIm1vbmV5Rm9ybWF0IjoiJCAxLDIzNC41NiJ9XSwiZXhwIjoxNjkxNzEyMDAwfQ.1K6TMVt0YXHPT1MeJ3MOOLlbEREfPfP5CDajQKAMYYk&quot;&gt;
  &lt;/script&gt;
  
  ...
  
  &lt;script type=&quot;text/javascript&quot; src=&quot;https://staging.example.org/subscribe/?civiwp=CiviCRM&amp;q=civicrm%2Fasset%2Fbuilder&amp;an=afform.js&amp;ad=3fff1ff13de9d8c09d3c1369c1765f8c&amp;aj=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImtpZCI6IjI3Qk1SZzFHek1sUF82VnJHT0hjbDlUcER5cyJ9.eyJhc3NldCI6WyJhZmZvcm0uanMiLHsibmFtZSI6ImFmZm9ybVNpbXBsZVdlYlN1YnNjcmliZSJ9XSwiZXhwIjoxNjkxNzEyMDAwfQ.uEPAiGPB39cDeSCvsJ4GdBZve9sYiqntUkJJJoDTf4E&quot;&gt;
  &lt;/script&gt;
  </code></pre>
  <p>When I view those URLs, I get regular HTML rather than the expected javascript code.</p>
  <p>For comparison, here is how the src URLs for those two scripts show up on the functioning, standalone page:</p>
  <pre><code>&lt;script type=&quot;text/javascript&quot; src=&quot;https://staging.example.org/action/asset/builder/?an=crm-l10n.js&amp;ad=f3081b489b9b5eebdeb885ee6fdda8ff&amp;aj=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImtpZCI6IjI3Qk1SZzFHek1sUF82VnJHT0hjbDlUcER5cyJ9.eyJhc3NldCI6WyJjcm0tbDEwbi5qcyIseyJjaWQiOjEsImluY2x1ZGVFbWFpbEluTmFtZSI6dHJ1ZSwiYWpheFBvcHVwc0VuYWJsZWQiOnRydWUsImFsbG93QWxlcnRBdXRvZGlzbWlzc2FsIjp0cnVlLCJyZXNvdXJjZUNhY2hlQ29kZSI6IlhobjAxZW5fVVMiLCJsb2NhbGUiOiJlbl9VUyIsImxjTWVzc2FnZXMiOiJlbl9VUyIsImRhdGVJbnB1dEZvcm1hdCI6Im1tXC9kZFwveXkiLCJ0aW1lSW5wdXRGb3JtYXQiOjEsIm1vbmV5Rm9ybWF0IjoiJCAxLDIzNC41NiJ9XSwiZXhwIjoxNjkxNzEyMDAwfQ.6JQJHlTwoijHEHEbaV8I8P2rLsl34Utf0vsQBOjnTNY&quot;&gt;
  &lt;/script&gt;
  
  ...
  
  &lt;script type=&quot;text/javascript&quot; src=&quot;https://staging.example.org/action/asset/builder/?an=afform.js&amp;ad=3fff1ff13de9d8c09d3c1369c1765f8c&amp;aj=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImtpZCI6IjI3Qk1SZzFHek1sUF82VnJHT0hjbDlUcER5cyJ9.eyJhc3NldCI6WyJhZmZvcm0uanMiLHsibmFtZSI6ImFmZm9ybVNpbXBsZVdlYlN1YnNjcmliZSJ9XSwiZXhwIjoxNjkxNzEyMDAwfQ.uEPAiGPB39cDeSCvsJ4GdBZve9sYiqntUkJJJoDTf4E&quot;&gt;
  &lt;/script&gt;
  </code></pre>
  <p>Those latter two scripts show the expected javascript code.</p>
  <p>Is there a setting somewhere I can tweak so that the scripts load as expected?  Are there other troubleshooting steps I should take?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-08-09T19:57:30.517Z
Comments.Text: Can you detail what theme you are using?  I've just tested on WP 6.3 and CiviCRM 5.64.0 and shortcode pages are working well with Kadence theme as well as twentythirteen.
Comments.UserDisplayName: Kevin Cristiano
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-08-09T20:32:58.467Z
Comments.Text: I am actually using Kadence (Kadence Pro).
Comments.UserDisplayName: Robert
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-08-09T20:39:29.577Z
Comments.Text: Update: I also tried twentythirteen and have the same issue.  The standalone Form Builder page works fine, but when embedding a form using shortcode, those two scripts fail to load.
Comments.UserDisplayName: Robert
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-08-09T21:25:22.160Z
Comments.Text: This is a bit odd.   So I couldn't reproduce using the same theme.  Ironic considering all the themes out there.   Can you look at disabling plugins to see if there is a conflict.
Comments.UserDisplayName: Kevin Cristiano
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-08-09T22:10:52.457Z
Comments.Text: I just spun up a brand new, blank WP/Civicrm install to help with troubleshooting.
  
  I can confirm that I was able to see the embedded shortcode is working.  Interestingly, when I go to view the source, rather than appending a query string with ?civiwp (and I guess trying to dynamically generate the content?), the two previously-offending scripts now point to actual javascript .js files under /wp-content/uploads.
Comments.UserDisplayName: Robert
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-08-09T22:57:38.290Z
Comments.Text: Update:  I think there were two things going on.  At least part of the issue may be related to the debug setting.  I had debugging enabled because I am working on a development version of the site.  And Asset Caching was set to "auto".  When I disabled debugging in CiviCRM, the form appears to work since it points directly to the .js files.
  
  The other thing going on was the "Shortcode Display Mode".  I had enabled  "remain in shortcode mode", when I switched back to Legacy Base Page Mode, things seem to work.
Comments.UserDisplayName: Robert
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-01-17T23:11:47.450Z
Comments.Text: I was having the same issue, and disabling debugging was enough to fix it for me. I still have Asset Caching set to Auto and the Shortcode Display Mode set to Remain in Shortcode Mode.
Comments.UserDisplayName: guyiac
Tags: <wordpress><formbuilder>
Title: FormBuilder forms not embedding on pages, but are visible as standalone pages, potentially due to script URL issue in WordPress
ThreadText: # FormBuilder forms not embedding on pages, but are visible as standalone pages, potentially due to script URL issue in WordPress
  
  (Asked by: username_0 on 2023-08-09)
  
  CiviCRM: 5.64
  CMS: WordPress 6.3
  I created a simple form in Form Builder and am hoping to embed it in a WordPress page. I also gave the form a standalone page for testing, and the form works well there. My CiviCRM base page is "/action", and the standalone form works well when I try out: https://staging.example.org/action/test
  However, when I try to embed the form using a shortcode [civicrm component="afform" name="afformTest"], the form fails to display.  I am trying to embed the form in a page at https://staging.example.org/subscribe.  I dove into the source code comparing both pages, and it looks like there are two CiviCRM scripts that fail to load on that /subscribe page.  Both are trying to load using a script URL that starts with the page I am trying to embed the form on:
  
  
  ...
  
  
  
  When I view those URLs, I get regular HTML rather than the expected javascript code.
  For comparison, here is how the src URLs for those two scripts show up on the functioning, standalone page:
  
  
  ...
  
  
  
  Those latter two scripts show the expected javascript code.
  Is there a setting somewhere I can tweak so that the scripts load as expected?  Are there other troubleshooting steps I should take?
  
  **Tags:** wordpress, formbuilder
  
  > **Comments:**
  > **username_1**: Can you detail what theme you are using?  I've just tested on WP 6.3 and CiviCRM 5.64.0 and shortcode pages are working well with Kadence theme as well as twentythirteen.  
  > **username_0**: I am actually using Kadence (Kadence Pro).  
  > **username_0**: Update: I also tried twentythirteen and have the same issue.  The standalone Form Builder page works fine, but when embedding a form using shortcode, those two scripts fail to load.  
  > **username_1**: This is a bit odd.   So I couldn't reproduce using the same theme.  Ironic considering all the themes out there.   Can you look at disabling plugins to see if there is a conflict.  
  > **username_0**: I just spun up a brand new, blank WP/Civicrm install to help with troubleshooting.  I can confirm that I was able to see the embedded shortcode is working.  Interestingly, when I go to view the source, rather than appending a query string with ?civiwp (and I guess trying to dynamically generate the content?), the two previously-offending scripts now point to actual javascript .js files under /wp-content/uploads.  
  > **username_0**: Update:  I think there were two things going on.  At least part of the issue may be related to the debug setting.  I had debugging enabled because I am working on a development version of the site.  And Asset Caching was set to "auto".  When I disabled debugging in CiviCRM, the form appears to work since it points directly to the .js files.  The other thing going on was the "Shortcode Display Mode".  I had enabled  "remain in shortcode mode", when I switched back to Legacy Base Page Mode, things seem to work.  
  > **username_2**: I was having the same issue, and disabling debugging was enough to fix it for me. I still have Asset Caching set to Auto and the Shortcode Display Mode set to Remain in Shortcode Mode.  
  
  ---
  
  ## 0 answers
  
  