• Hi,

    Whenever I am trying to add custom html in my post content (such as google ads) I get the following message:

    “Updating failed. The response is not a valid JSON response.”

    This is even happening if I only enter following as HTML code:

    <script>

    I did look up at many online solutions but this is constantly happening and only when trying to add custom html code which contains <script>.

    My site is: CuriousMatrix.com

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • You seem to be using a PageBuilder for content maintenance that is provided by the theme developer whose theme you purchased. I would recommend you to contact their support: https://themeforest.net/item/newspaper/5489609/support – questions about commercial products are not allowed here in the forum. In this case, no one here on the forum can judge how this PageBuilder handles HTML codes. Only the support of this plugin/theme can do that.

    Thread Starter dpernar

    (@dpernar)

    Thank you for your response. I actually do not use tag div theme builder for posts. I use pire Gutenberg editor when adding new posts.

    And previously I was able to add custom html with Java scripts.

    Really don’t know what is happening here. Some people on support forums are saying that this could be a problem of insufficient privilegies as administrator but I don’t think this is the case on my site.

    I can easily add scripts in different part of pages like in widgets. But not in regular posts for some reason.

    I can’t reproduce this on my end. I created a HTML block in the block editor of a post and there I put

    <script>alert('Hello World');</script>

    inserted. The post can be saved normally.

    If this does not work for you, it may be due to plugins you use, such as your PageBuilder which nevertheless acts as a plugin in the background. Deactivate all plugins to exclude them as a cause. If it still doesn’t work, it might be the code you want to insert or the way you insert it in the block editor. If it works without all plugins, activate them one by one until you find the guilty plugin.

    Thread Starter dpernar

    (@dpernar)

    Thank you for your response. I will try to turn off all plugins. The code is surely not a problem as I can not even insert only solo : <script> .

    I also checked if I have unfiltered_html rights and I have so this is no issue.

    Anyhow, I’ll turn off all plugins and then come back to this thread.

    Thread Starter dpernar

    (@dpernar)

    Actually, now I tried to write <script> as normal text, so without HTML block and I can’t even do that.

    See here:
    https://imgur.com/3QaEINA

    This is really weird.

    Thread Starter dpernar

    (@dpernar)

    Update:

    I deactivated all plugins. Still not working. Can’t even insert simple script. Anything that starts with <script> is blocked instantly when trying to save article as draft.

    Could it be something in my functions.php file or .htaccess file?

    Don’t just write <script> but if so a valid HTML code, like my one above:

    <script>alert('Hello World');</script>

    Furthermore: don’t write the HTML code in a paragraph block but in the HTML block. The paragraph block will encode the code so that it is output as text. The HTML block does not do that.

    The .htaccess has nothing to do with it.

    In the functions.php of your theme there could be an entry that prevents script elements.

    • This reply was modified 2 years, 4 months ago by threadi.
    Thread Starter dpernar

    (@dpernar)

    Update 2:

    I installed also classic editor and I can enter scripts there. So I’ll use this as temporary solution as it seems that I can’t fix gutenberg in any way.

    If you have any additional recommendations please share?

    Thread Starter dpernar

    (@dpernar)

    Thank you for your answer.

    I did try your code or any other code. It does not work.
    Pure HTML (without script) works. NOthing else.

    I’ll also recheck my function.php.

    Until then, combination of Classic editor and Gutenberg will do.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Script custom html in post content’ is closed to new replies.