• heyyoufinance

    (@heyyoufinance)


    Hello. When I try to paste HTML code into the block editor, my post is not able to be saved or updated and generates this error code “Updating failed. The response is not a valid JSON response.” I’ve been advised that this is a block editor problem and I should switch to the classic editor, but I much prefer using the block editor and would like to resolve this compatibility issue between the HTML code and the block editor. Thank you.

Viewing 15 replies - 16 through 30 (of 30 total)
  • mrtom414

    (@mrtom414)

    Looks like one of googles functions is having a problem. You might want to check with them. It appears it having problems pushing the ads into the ins container. It could be because it is unable to see the container for some reason. If the script runs before the container is created then It will not be able to locate it. I suggest trying it with the plugin to see if it resolves the problem. If it doesn’t you will need to see if anyone at google can figure out why their script is having a problem.

    herrstitches

    (@herrstitches)

    I’m having the exact same issue! I’ve tried HTML codes from multiple sources (both Google Adsense and FloDesk), and neither of them works. It is only the Custom HTML of the Block Editor giving me issues. It only started within the last few days. Did you find anything to resolve the issue other than switching to the Classic Editor?

    saketyeotikar

    (@saketyeotikar)

    I am also having the same issue embedding the subscribe newsletter form using custom HTML block. I encountered this after updating wordpress to 5.9.2.

    If I insert the same code in the sidebar (Demoting to classic widgets using a plugin) the code works perfectly fine.

    I think there is something conflicting in the block editor and some specific themes.

    I also think that using multiple block plugins may be one of the reason.

    My theme is Kadence theme and they have said the error is 403 meaning a issue from a hosting provider. But my host is saying it is not from their side.

    Completely lost in this wordpress mess.

    Thread Starter heyyoufinance

    (@heyyoufinance)

    I’m glad I’m not the only one experiencing this issue. I believe it’s evident that there are some compatibility issues with WordPress/block editor/maybe certain themes/HTML codes. Unfortunately, I’ve not been able to find a solution. Yes, switching to Classic editor works, but it’s not a sustainable solution for the long term in my opinion. My theme is Generate Press for reference. I’m hoping since this is looking to be a widespread issue, WordPress works out the kinks.

    Moderator threadi

    (@threadi)

    I have never had such a problem, so would rather guess individual problems. Therefore we need more information from the affected installation to be able to help in the context of this forum.

    You have already tested a few things. Nevertheless, I am also faced with a riddle here. Could you please post the info output of the health screen here? This is described in more detail here: https://wordpress.org/support/article/site-health-screen/

    Please also check in the health view if there are any warnings. No matter what.

    Further please: you write “there was no change to the config”. My query was about the content of wp-config.php. Could you please actually check thisfile and post the bottom lines of it here?

    As described above, you are of course free to look for someone who can help you directly with the check on your system. This could be done as written via https://jobs.wordpress.net.

    mrtom414

    (@mrtom414)

    I took another look at this. I found this article on the problem. The problem has to do with how React updates the screen. The ins that is the target for the Adsense code is being redrawn. Because the screen is redrawn the adsense script is unable to find the target and basically crashes. I don’t think there is an easy fix for this. It going to take someone writing a block that is not redrawn when react redraws the screen.

    • This reply was modified 4 years ago by mrtom414.
    mrtom414

    (@mrtom414)

    I’m not really sure my post above is correct. Although the backend is built on react the front end is still HTML. You might be able to take the scripts out and enqueue them after everything else has been loaded. It all depends on the sequence the files need to be loaded and executed.

    You could also try pasting the code in using the code view. I’m not sure what will happen if you do. My guess is that it would try to convert it into a block.

    herrstitches

    (@herrstitches)

    I tried pasting the code in code view and it is still throwing the JSON error. I used both a Google Adsense code and a FloDesk email form code and they both are throwing the same error. As soon as I delete the Custom HTML block, the page can be saved as normal and is otherwise fine. So it appears to be just the block having the problem? I did an online chat with my host and they couldn’t figure out why the Custom HTML block is having issues either.

    Thread Starter heyyoufinance

    (@heyyoufinance)

    Has anyone had any luck resolving this issue?

    I did! I used the plugin “Ad Inserter” to insert all my HTML codes and that worked! And it saves a lot of time because then you don’t have to manually keep adding Adsense code into every single post.

    I am trying to create pages that are very simple. Just using “custom HTML” block. It should be simple, but seems to reject valid code. I want to add a “custom HTML” block with a couple of <styles>, then a “custom HTML” block of a <script>. Then “custom HTML” block of content. I wish the first two blocks to affect all pages, so they would ideally be in the theme. The other one would be in the page.
    I was trying to put them all in the page, but had many problems. Viewing might fail, then shutting down and re-starting might almost work. This does not seem stable. (Or maybe it is just me not stable : -).
    I am on 5.9.3. I was hoping to use the Twenty Twenty Two theme with a modified page template. I am in a little over my head here. Any and all help would be appreciated.

    I am having the same issues with 2 brand new, clean sites, with just the Kadence theme, a mail plugin and WPML installed. When using the block editor, custom html block, I can’t even put in an empty <script></script> without getting that JSON error. Switching to Classic editor allows me to do what I want.

    I’m surprised this issue isn’t more widely recognized, but in fact I have 3 new sites, and I’m only experiencing the issue on 2 of them. Aside from some styling, the sites are the same.

    I’ve no idea what’s going on.

    Yep – having the same problem and have not found anyone with a fix. Very frustrating. Block works well for me but this really stops what should be a very simple action. Block editor clearly shows the option of using a block for “Custom HTML” But it just doesn’t work!

    • This reply was modified 3 years, 10 months ago by KCGuy.

    has anyone found a solution to this yet? i’m having the same problem

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

Viewing 15 replies - 16 through 30 (of 30 total)

The topic ‘HTML code posting error in Block Editor’ is closed to new replies.