Title: Script Deletion Issue: HTML Tweet Code Removes JavaScript
Last modified: June 27, 2023

---

# Script Deletion Issue: HTML Tweet Code Removes JavaScript

 *  Resolved [williambeltran](https://wordpress.org/support/users/williambeltran/)
 * (@williambeltran)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/script-deletion-issue-html-tweet-code-removes-javascript/)
 * Hello, good morning everyone. Thank you in advance for your help. I am a wrestling
   news writer at Superluchas.com, the number one Spanish-language website for wrestling
   news (WWE, AEW, etc.).
 * I have a problem: I want to embed a tweet in my article. I do this by copying
   the HTML code generated from the “Embed Tweet” feature on the Twitter Publish
   website. An example of the code is as follows:
   `<blockquote class="twitter-tweet"
   ><p lang="en" dir="ltr">The <a href="https://twitter.com/WWEUsos?ref_src=twsrc%
   5Etfw">@WWEUsos</a> are getting a head start for <a href="https://twitter.com/
   hashtag/MITB?src=hash&amp;ref_src=twsrc%5Etfw">#MITB</a> by taking down <a href
   ="https://twitter.com/WWESoloSikoa?ref_src=twsrc%5Etfw">@WWESoloSikoa</a> tonight
   on <a href="https://twitter.com/hashtag/SmackDown?src=hash&amp;ref_src=twsrc%
   5Etfw">#SmackDown</a>! 😤<a href="https://twitter.com/hashtag/TheBloodline?src
   =hash&amp;ref_src=twsrc%5Etfw">#TheBloodline</a> CIVIL WAR. ☝️ WEEK from TOMORROW.
   <br><br>The <a href="https://twitter.com/WWEUsos?ref_src=twsrc%5Etfw">@WWEUsos
   </a> vs. <a href="https://twitter.com/WWERomanReigns?ref_src=twsrc%5Etfw">@WWERomanReigns
   </a> and <a href="https://twitter.com/WWESoloSikoa?ref_src=twsrc%5Etfw">@WWESoloSikoa
   </a>!<br><br>How will this war end? 😳 <a href="https://t.co/KN7M1I3UBU">pic.
   twitter.com/KN7M1I3UBU</a></p>&mdash; WWE (@WWE) <a href="https://twitter.com/
   WWE/status/1672424866228649984?ref_src=twsrc%5Etfw">June 24, 2023</a></blockquote
   > <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"
   ></script>`
 * I paste this code into the HTML Editor, not the Visual Editor in WordPress, and
   it is supposed to display the tweet correctly when I go back to the Visual editor,
   view the draft, or publish the article. However, the tweet is not visible, only
   the text appears as a quote, using the blockquote format.
 * I have identified that the problem occurs when I publish the article or save 
   it as a draft. The following part of the HTML code is automatically removed: 
   <script async src=”[https://platform.twitter.com/widgets.js&#8221](https://platform.twitter.com/widgets.js&#8221);
   charset=”utf-8″></script>
 * This is a problem that only affects me. Other contributors from Mexico, Spain,
   the United States, etc., can embed tweets in this way without any issues.
 * I would like to know why this problem is occurring. I created a completely new
   account, but the problem persists. However, I asked another colleague from Mexico
   to try embedding the tweet, and they were successful. Could this be a problem
   specific to Colombia? I am the only contributor from Colombia.
 * I have also tested this in all available browsers, but it doesn’t work. I don’t
   know what else to do. I have always had problems when embedding HTML code, for
   example, from Streamable.
 * Thank you very much, and I will be attentive to any solutions or comments. It’s
   worth mentioning that installing plugins or modifying the website’s code is not
   possible for various reasons, and because I am the only one experiencing this
   problem.
 * [Original-HTML-Code.jpg](https://postimg.cc/bsF5r7Px)
   [HTML-Code-without-Java-Script.jpg](https://postimg.cc/KRLGDDYg)
   [HTML-Code-without-Java-Script-2.jpg](https://postimg.cc/PN0fDRdj)[HTML-Code-without-Java-Script-3.jpg](https://postimg.cc/5jXN6Vdg)
    -  This topic was modified 2 years, 11 months ago by [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/).

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

 *  [George Appiah](https://wordpress.org/support/users/gappiah/)
 * (@gappiah)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/script-deletion-issue-html-tweet-code-removes-javascript/#post-16852308)
 * The screenshots you provided are from a WordPress account with the **AUTHOR**
   role.
 * By default, only users with the **ADMINISTRATOR** and **EDITOR** roles have the`
   unfiltered_html` capability which permits the posting of arbitrary HTML/JS code.
 * A WordPress user with the **AUTHOR **role does not have permission to post arbitrary
   code, that’s why your JavaScript code is stripped out by WordPress.
 * See WordPress’ native user roles and capabilities here: [https://wordpress.org/documentation/article/roles-and-capabilities/](https://wordpress.org/documentation/article/roles-and-capabilities/)
 * And, by the way, if you were to be using the block editor (aka Gutenberg), all
   you’d have to do to embed a tweet would be to copy the Tweet’s URL from your 
   browser, like:
 * `https://twitter.com/WWE/status/1672424866228649984`
 * … and paste it in the editor: WordPress would automatically add all the necessary
   code to embed the tweet. No need to spay all those codes inside your posts as
   seen in your screenshots. And as a bonus, this works for all user roles.
 *  Thread Starter [williambeltran](https://wordpress.org/support/users/williambeltran/)
 * (@williambeltran)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/script-deletion-issue-html-tweet-code-removes-javascript/#post-16861675)
 * Hello, George Appiah (@gappiah)! You are absolutely right. While I still have
   the role of AUTHOR, the site ADMINISTRATOR modified that file and granted me 
   the ability to allow arbitrary posting of HTML/JS code. God bless you. Thank 
   you very much for your solution. Sending you a big hug and greetings.

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

The topic ‘Script Deletion Issue: HTML Tweet Code Removes JavaScript’ is closed 
to new replies.

## Tags

 * [administrator](https://wordpress.org/support/topic-tag/administrator/)
 * [author](https://wordpress.org/support/topic-tag/author/)
 * [java](https://wordpress.org/support/topic-tag/java/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [js](https://wordpress.org/support/topic-tag/js/)
 * [twiter](https://wordpress.org/support/topic-tag/twiter/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [williambeltran](https://wordpress.org/support/users/williambeltran/)
 * Last activity: [2 years, 11 months ago](https://wordpress.org/support/topic/script-deletion-issue-html-tweet-code-removes-javascript/#post-16861675)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
