0

I recently upgraded WordPress from 4.3 version to 5.0.3 version.

Now I am trying to add following code in to a page of a WordPress site in the Gutenberg editor.

<!--[if lte IE 8]>
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"></script>
<![endif]-->
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"></script>
<script>
  hbspt.forms.create({
    portalId: "xyz",
    formId: "abc",
    sfdcCampaignId: "pqr"
});
</script>

I get following error in the console

/wp-json/wp/v2/pages/4713/autosaves?_locale=user 500 (Internal Server Error)

Screenshot

I have tried following to fix it.

  1. Updated and saved permalinks : did not work
  2. Checked WordPress logs : no error messages, only some notices
  3. No specific errors in the error logs

As of now I have installed classic editor plugin and it allow to save this script.

How to fix this issue with Block editor

5
  • What is js.hsforms.net? Is it related to a WordPress plugin?
    – Pat J
    Mar 15, 2019 at 14:31
  • @PatJ js.hsforms.net is to add hubspot forms
    – Mukesh
    Mar 15, 2019 at 14:39
  • As far as I know I don't think you can by default. You could create your own custom block to allow adding scripts, or use a plugin to do so. You could also take out this code and add it in footer.php with a page conditional. Mar 15, 2019 at 15:00
  • @RiddleMeThis ok, but if I add same to the classic editor it works.
    – Mukesh
    Mar 15, 2019 at 15:59
  • 2
    The classic editor and the new block editor are very much different. Mar 15, 2019 at 16:23

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.