• After upgrading to 5.8, I can save my widgets when I have a custom HTML block, but not if I include the following code in the custom html block:

    <script type="text/javascript">(function(d){var f = d.getElementsByTagName('SCRIPT')[0], p = d.createElement('SCRIPT');p.type = 'text/javascript';p.async = true;p.src = '//widgets.wp.com/platform.js';f.parentNode.insertBefore(p,f);}(document));</script>

    When trying to Update widgets:
    There was an error. The response is not a valid JSON response.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Moderator t-p

    (@t-p)

    The response is not a valid JSON

    It may be a lot of different things:
    – a plugin conflict either 1) a plugin doing something that creates output, thus breaking the response or 2) a plugin doing something with caching),
    – an overloaded server,
    – misconfigured http/https address in General Settings,
    – permalinks may need resetting,
    – theme/plugin conflict,
    – check Site Health: From your WordPress dashboard, if you go to Tools and then select Site Health, then under the Status tab on that page, WordPress will show you any improvement recommendations that could help your website. An issue related to Rest API could also cause the JSON response error on your website. Moreover, if you find any issue there, solving the issue might also fix the JSON response error for your website, etc.

    Thread Starter dlin04

    (@dlin04)

    – all plugins disabled
    – twenty twenty theme
    – server appears responsive, if I remove the code from the custom html block, it updates just fine
    – site health is good

    – I will have to check permalinks?

    Thread Starter dlin04

    (@dlin04)

    – reset permalinks
    – checked https addresses in general settings – no issues, just root https on domain

    Moderator t-p

    (@t-p)

    Can’t Update Widgets with WordPress.com

    You are at www.ads-software.com ??

    WordPress.COM??

    Thread Starter dlin04

    (@dlin04)

    I’m fully aware that I am www.ads-software.com. I am using WordPress. It is privately hosted. It is the www.ads-software.com software that is not able to update the widgets on my www.ads-software.com site when I add javascript to the custom html block.

    Are you trying to tell me that this is not an issue with the WordPress software?

    Is there some reason why the custom HTML block in widgets won’t support the following code?
    <script type="text/javascript">(function(d){var f = d.getElementsByTagName('SCRIPT')[0], p = d.createElement('SCRIPT');p.type = 'text/javascript';p.async = true;p.src = '//widgets.wp.com/platform.js';f.parentNode.insertBefore(p,f);}(document));</script>

    Thread Starter dlin04

    (@dlin04)

    Please treat this like you would any other javascript – why is the custom HTML block not updating when I have javascript in it?

    If it will work with other javascript, why does THIS javascript cause only version 5.8 of wordpress to not be able to update widgets?

    Thread Starter dlin04

    (@dlin04)

    FYI, I said “WordPress.com Follow Button” which is the script in question.

    Moderator t-p

    (@t-p)

    “WordPress.com Follow Button” which is the script in question.

    Is this WordPress.com Follow Button out putted by your active theme? if so, I recommend asking at that theme’s support so the theme’s developers and support community can help you with this.

    Or, if it is out putted by a plugin, then i recommend asking at that theme’s support so the plugin’s developers and support community can help you with this.

    Thread Starter dlin04

    (@dlin04)

    The

    WordPress.com Follow Button

    is just some html code, generated here:
    https://wordpress.com/support/follow-button/

    In my case, the html code in its entirety, as copied into the Custom HTML block:
    <p><a class="wordpress-follow-button" href="https://mudkingdom.com" data-blog="https://mudkingdom.com" data-lang="en">Follow The Mud Kingdom</a><script type="text/javascript">(function(d){var f = d.getElementsByTagName('SCRIPT')[0], p = d.createElement('SCRIPT');p.type = 'text/javascript';p.async = true;p.src = '//widgets.wp.com/platform.js';f.parentNode.insertBefore(p,f);}(document));</script></p>

    It is not output by a plugin – I’ve tried this with all plugins disabled and using the Twenty Twenty default theme.

    Now this renders just fine in 5.7, and it is currently rendering on my blog. The trouble is that I just can’t update my widgets at all with that html code in my custom html block. It’s very odd.

    Thread Starter dlin04

    (@dlin04)

    Thread Starter dlin04

    (@dlin04)

    Ok, this gets even crazier.

    Pasting this into a Custom HTML block on the Widgets page will result in “There was an error. The response is not a valid JSON response.” upon attempting to update Widgets:
    <a class="wordpress-follow-button" href="https://mudkingdom.com" data-blog="https://mudkingdom.com" data-lang="en">Follow The Mud Kingdom on WordPress.com</a><script type="text/javascript">(function(d){var f = d.getElementsByTagName('SCRIPT')[0], p = d.createElement('SCRIPT');p.type = 'text/javascript';p.async = true;p.src = '//widgets.wp.com/platform.js';f.parentNode.insertBefore(p,f);}(document));</script>

    BUT, pasting the following into a Custom HTML block on the Widgets page will result in normal updating upon attempting to update Widgets:

    <a class="wordpress-follow-button" href="https://mudkingdom.com" data-blog="https://mudkingdom.com" data-lang="en">Follow The Mud Kingdom on WordPress.com</a><script type="text/javascript">
    (function (d) {
        var f = d.getElementsByTagName("SCRIPT")[0],
            p = d.createElement("SCRIPT");
        p.type = "text/javascript";
        p.async = true;
        p.src = "//widgets.wp.com/platform.js";
        f.parentNode.insertBefore(p, f);
    })(document);</script>

    VERY ODD BEHAVIOR – the code is functionally the same, but with some line breaks in the part that will run. Yet, one prevents Widgets from updating (saving). The other one won’t.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Can’t Update Widgets with WordPress.com Follow Button in Custom HTML Block’ is closed to new replies.