Title: Text edit widgets stripping out code..
Last modified: December 20, 2017

---

# Text edit widgets stripping out code..

 *  Resolved [EMar](https://wordpress.org/support/users/sounds/)
 * (@sounds)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/text-edit-widgets-stripping-out-code/)
 * Hi,
 * Is there something wrong in wordpress that’s causing text widgets to strip out
   code?
 * I have a piece of code in the text widget that displays now playing song info,
   
   It still works in any widget I haven’t updated recently, however if I update 
   the code in the text widget or any other editor widget like SiteOrigin, then 
   it won’t display the info in the widget when viewing it on the site.
 * So I installed the Classic text Widget which does fix the problem.
    But I don’t
   think I should have to install another widget to fix the problem.
 * What’s causing these other text widgets to strip the code?

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

 *  Moderator [James Huff](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/text-edit-widgets-stripping-out-code/#post-9798834)
 * Use the Custom HTML widget instead of the Text widget for code like that.
 *  Thread Starter [EMar](https://wordpress.org/support/users/sounds/)
 * (@sounds)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/text-edit-widgets-stripping-out-code/#post-9798901)
 * I did try that Custom HTML widget, again just now, but there’s a few warnings,
 * Example:
 * “websiteUrl” is defined but never used.
    “showPlayer” is defined but never used.“
   shoutcastUrl” is defined but never used. “autostartPlayer” is defined but never
   used. “displayPlayer” is defined but never used.
 * <script>
    //settings var websiteUrl = ‘[https://www.h.ie/shoutcastinfo-ambient/&#8217](https://www.h.ie/shoutcastinfo-ambient/&#8217);;//
   website url var showPlayer = ‘0’;//show player status var shoutcastUrl = ‘198.56.145.147:
   8655’;//shoutcast stream server url var autostartPlayer = false;//autostart player
   status var displayPlayer = ‘top’;//player area </script> <script type=”text/javascript”
   src=”[https://www.t.ie/shoutcastinfo-ambient/js/main.js”></script&gt](https://www.t.ie/shoutcastinfo-ambient/js/main.js”></script&gt);
   <!–end shoutcast javascripts–>
 *  [alexgso](https://wordpress.org/support/users/alexgso/)
 * (@alexgso)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/text-edit-widgets-stripping-out-code/#post-9799304)
 * Hi sounds,
 * Those are valid warning messages and they’re occurring as the custom HTML editor
   isn’t able to see the full scope of the script. They’re safe to ignore.
 *  Thread Starter [EMar](https://wordpress.org/support/users/sounds/)
 * (@sounds)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/text-edit-widgets-stripping-out-code/#post-9799692)
 * That Custom HTML widget doesn’t want to work for me.
    It’s asking me to add a
   few double quotes, but I can’t save it.
 *  [HudsonValleyWebDesign](https://wordpress.org/support/users/jaycbrf/)
 * (@jaycbrf)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/text-edit-widgets-stripping-out-code/#post-9799961)
 * I do not think it likes the mixing single and double quotes – also it is for 
   HTML, not adding Javascript to the site. Javascript should be added via file 
   [https://codex.wordpress.org/Using_Javascript](https://codex.wordpress.org/Using_Javascript)
    -  This reply was modified 8 years, 6 months ago by [HudsonValleyWebDesign](https://wordpress.org/support/users/jaycbrf/).
 *  Thread Starter [EMar](https://wordpress.org/support/users/sounds/)
 * (@sounds)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/text-edit-widgets-stripping-out-code/#post-9800126)
 * I’m using the Classic text Widget for now, it’s too much.
    Why are all these 
   text editors stripping out the code in the first place?
 *  [HudsonValleyWebDesign](https://wordpress.org/support/users/jaycbrf/)
 * (@jaycbrf)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/text-edit-widgets-stripping-out-code/#post-9804472)
 * Code can cause exploits – it is for security.
 * And cause that is not where scripts go…
 *  Thread Starter [EMar](https://wordpress.org/support/users/sounds/)
 * (@sounds)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/text-edit-widgets-stripping-out-code/#post-9805055)
 * I see, but it can get a bit annoying, didn’t work in siteorigin editor either.
   
   The classic text widget works but I don’t want a plugin for every single fix.
 *  [HudsonValleyWebDesign](https://wordpress.org/support/users/jaycbrf/)
 * (@jaycbrf)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/text-edit-widgets-stripping-out-code/#post-9806305)
 * What do you mean a plugin? Javascript is not to be entered that way – it is not
   best practice. Use conditional functions to enqueue scripts on the pages that
   need them, or create custom template pages.
 *  Thread Starter [EMar](https://wordpress.org/support/users/sounds/)
 * (@sounds)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/text-edit-widgets-stripping-out-code/#post-9806470)
 * I mean I used classic text widget to display some javascript in the sidebar.
   
   [Demo](https://snag.gy/BzVJcL.jpg)
 * I need to find a better way to do this, I’m using a new widget for every page.
   
   But that’s another story.
 *  [HudsonValleyWebDesign](https://wordpress.org/support/users/jaycbrf/)
 * (@jaycbrf)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/text-edit-widgets-stripping-out-code/#post-9817621)
 * Is it a different script for every widget on every page?
 *  Thread Starter [EMar](https://wordpress.org/support/users/sounds/)
 * (@sounds)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/text-edit-widgets-stripping-out-code/#post-9817857)
 * Well it’s the same script but reused on different pages, I create radio pages.
   
   I have to enter different stream info in each widget for each shoutcast stream.
   It gets a bit heavy when you have multiple radio pages, now playing widget for
   each page.
 *  [HudsonValleyWebDesign](https://wordpress.org/support/users/jaycbrf/)
 * (@jaycbrf)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/text-edit-widgets-stripping-out-code/#post-9818276)
 * You can hardcode the script into a custom template page and use that template
   on pages that need the script. You can then modify the script a bit to look for
   a data-attribute for the stream url. Add the stream url to the link’s data-stream-
   url=”stream url”
 *  Thread Starter [EMar](https://wordpress.org/support/users/sounds/)
 * (@sounds)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/text-edit-widgets-stripping-out-code/#post-9820513)
 * That is kind of what I did, I got the script off code canyon [link](https://codecanyon.net/item/shoutcast-info-stats-v15/2410928)
   
   It has a horizontal and vertical php file which I embeded in a widget. One widget
   for each radio page, new shoutcast stream info in each widget, I can’t think 
   of a better way to display the info without using separate widgets.

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

The topic ‘Text edit widgets stripping out code..’ is closed to new replies.

## Tags

 * [custom html widget](https://wordpress.org/support/topic-tag/custom-html-widget/)
 * [text widget](https://wordpress.org/support/topic-tag/text-widget/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 14 replies
 * 4 participants
 * Last reply from: [EMar](https://wordpress.org/support/users/sounds/)
 * Last activity: [8 years, 5 months ago](https://wordpress.org/support/topic/text-edit-widgets-stripping-out-code/#post-9820513)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
