Title: Script custom html in post content
Last modified: November 10, 2022

---

# Script custom html in post content

 *  [dpernar](https://wordpress.org/support/users/dpernar/)
 * (@dpernar)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/script-custom-html-in-post-content/)
 * 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](https://CuriousMatrix.com)
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fscript-custom-html-in-post-content%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/script-custom-html-in-post-content/#post-16187580)
 * 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](https://themeforest.net/item/newspaper/5489609/support)–
   questions about commercial products [are not allowed here in the forum](https://wordpress.org/support/guidelines/#do-not-post-about-commercial-products).
   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](https://wordpress.org/support/users/dpernar/)
 * (@dpernar)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/script-custom-html-in-post-content/#post-16187617)
 * 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.
 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/script-custom-html-in-post-content/#post-16190627)
 * 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](https://wordpress.org/support/users/dpernar/)
 * (@dpernar)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/script-custom-html-in-post-content/#post-16191507)
 * 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](https://wordpress.org/support/users/dpernar/)
 * (@dpernar)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/script-custom-html-in-post-content/#post-16191513)
 * 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](https://imgur.com/3QaEINA)
 * This is really weird.
 *  Thread Starter [dpernar](https://wordpress.org/support/users/dpernar/)
 * (@dpernar)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/script-custom-html-in-post-content/#post-16191538)
 * 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?
 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/script-custom-html-in-post-content/#post-16191548)
 * 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 3 years, 6 months ago by [threadi](https://wordpress.org/support/users/threadi/).
 *  Thread Starter [dpernar](https://wordpress.org/support/users/dpernar/)
 * (@dpernar)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/script-custom-html-in-post-content/#post-16191572)
 * 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](https://wordpress.org/support/users/dpernar/)
 * (@dpernar)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/script-custom-html-in-post-content/#post-16191928)
 * 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.

## Tags

 * [json](https://wordpress.org/support/topic-tag/json/)
 * [script](https://wordpress.org/support/topic-tag/script/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 9 replies
 * 2 participants
 * Last reply from: [dpernar](https://wordpress.org/support/users/dpernar/)
 * Last activity: [3 years, 6 months ago](https://wordpress.org/support/topic/script-custom-html-in-post-content/#post-16191928)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
