Support » Fixing WordPress » Issues with Twitter embeds in a widget

  • Having an issue with all our users where the code they copy from the Twitter page into a text widget is having code stripped out. Once they paste the code in and hit save part of the code is stripped out. I’m not sure why this is happening or how to stop it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Here is the code from Twitter:

    <a class="twitter-timeline"  href="https://twitter.com/Stockton_edu"  data-widget-id="289837535046279168">Tweets by @Stockton_edu</a>
    <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>

    This is what WP does to it.

    <a class="twitter-timeline" href="https://twitter.com/Stockton_edu">Tweets by @Stockton_edu</a>
    !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");

    For security reasons, WordPress does not allow <script> tags inside a post or page. Take a look at this page for ways to load Javascript on individual pages:

    http://codex.wordpress.org/Using_Javascript

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Issues with Twitter embeds in a widget’ is closed to new replies.