WordPress.org

Ready to get started?Download WordPress

Forums

Issues with Twitter embeds in a widget (3 posts)

  1. Stryker412
    Member
    Posted 1 year ago #

    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.

  2. Stryker412
    Member
    Posted 1 year ago #

    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");
  3. DustinHartzler
    Member
    Posted 1 year ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.