Support » Plugins » [Plugin: Text Widget] javascript tags get stripped from text widget on save

  • hi,

    WPMU install of wordpress 3.5.1 on a self-hosted site, child theme of standard “sight” theme from

    i’m trying to add a piece of javascript in the standard text widget for the sidebar that comes with all wordpress installs. we are using a child derivative of the “sight” theme.

    when i put the code in the text widget, it strips out the <script> tags — i’m wondering why? this is a self-hosted wordpress 3.5.1, i should be allowed, as admin, to put my own javascript in.

    so if i put in something like this —

    <script language="javascript" text="text/javascript">
    [ some javascript code here ]

    when i hit the ‘save’ button, the <script> get stripped out, so the code is just left there and shows as a block of text in the widget and is never run, of course. i’m wondering why this is happening with my install (3.5.1, WPMU, child of “sight” theme).

    this seems similar to posts put here on the forums previously, in previous wordpress versions —

    in that one, they say, in version 2.9.1, he should be able to add javascript to the standard text widget. has this functionality been taken out in 3.5.1?

    that is a situation similar to mine, where one admin has the script tags stripped out of the text widget on ‘save,’ but another admin can have the script tags in the text widget save just fine.

    so what is going on here?

    i’ve searched, but is there something in the codex that states explicitly you can’t put javascript in the wordpress text widget?

    please advise. thank you in advance.


    — faddah wolf
    portland, oregon

Viewing 2 replies - 1 through 2 (of 2 total)
  • Take a look at this post i made and resolved a few days ago. I know its not completely relevant to your issue but i was having character stripping issues with the press this reloaded plugin.


    If i were you i would look at my post and check the line of code i removed from the plugin and compare that to the widget code of your existing site, see if there is any similar code in there that is stripping characters.

    Its often a security practice to stop the use these characters as without that someone might find a way to bypass auth to a specific section of the admin interface (in your case the widget section), edit your widget code and implant some malicious code or redirecting code for their own profit. I imagine thats why WordPress stopped the functionality of that in widgets.

    Hope it helps a bit

    thanks. that’s a nice hack, but not really a solution to my problem. if they update core 3.5.x or the text widget itself, all that work gets wiped and/or i have to re-do it again (provided that code you hacked is available).

    i just want to know if it’s wordpress codex “canon” that you can’t put <script> tags in the text widget in the sidebar or not. if not, what can be done to fix that, short of hacking the code for the text widget.

    i do appreciate your answer, but i need to know why this is happening. thank you, though. still unresolved.


    — faddah wolf
    portland, oregon

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Text Widget] javascript tags get stripped from text widget on save’ is closed to new replies.