Beginner's Guide for WordPress / Start your WordPress Blog in minutes

How to Embed SWF in Your WordPress Posts

If you have ever tried embedding a Shockwave Flash file into your WordPress blog then you know it can get messy. Besides, if you are hosting your blog on WordPress.com then you are not going to be able to upload flash for security reasons. If you do have your hosting account, however, then there are several ways you can go about uploading .swf files to your WordPress blog posts. The first way involves using a plugin. This way is preferred if you are not good with code. The other way requires you to know some basic html. In this article we are going to go over how to embed SWF in WordPress posts with a plugin and without a plugin.

Plugin Method

First, you need to download and install Easy Flash Embed for WordPress. This plugin is so simple that no settings are even added to your admin menu. All you have to do is used a shortcode when you are creating your posts like this:

[swf src="http://www.example.com/my-flash-file.swf" width=300 height=100]

Simply replace the src attribute with a link to your flash file and adjust height and width accordingly.

Download Easy Flash Embed plugin.

Code Method

For those of you who would like more control over your code we are now going to show you how to embed flash files directly into your WordPress posts, pages, or even themes. Although people have come up with numerous methods for doing this over the years the easiest and most standards compliant way is to use the <object> element.

The final code looks like this:

<object id="flashcontent" 
        classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
        width="550px" 
        height="400px">
  <param name="movie" value="mymovie.swf" />
 
  <!--[if !IE]>-->
  <object type="application/x-shockwave-flash" 
          data="mymovie.swf" 
          width="550px" 
          height="400px">
  <!--<![endif]-->
 
    <p>
      Fallback or 'alternate' content goes here.
      This content will only be visible if the SWF fails to load.
    </p>
 
  <!--[if !IE]>-->
  </object>
  <!--<![endif]-->
 
</object>

Note that you are using 2 <object> elements. The outer element is targeting Internet Explorer while the inner element is for all the other browsers. You can change your fallback text if necessary. You can also add extra <param> options like wmode or allowScriptAccess.

P.S. you should always use wmode=transparent, so your embed doesn’t override existing content such as a floating bar. Check out our article on how to prevent Youtube oEmbed from overriding content.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit – a collection of WordPress related products and resources that every professional should have!

Reader Interactions

21 CommentsLeave a Reply

  1. Hi, I am using the code based version to embed a flash object onto a webpage – when I add more param tags these don’t seem to work. For example, I’m trying to add the allowFullScreen tag but it’s not working when I view the page. How do I add more tags?
    Thanks!

  2. Hi..! I’ve done embed .swf video in my wordpress site. Videos created using camtasia. Now I want to know that how to limit these videos to subscribed users only. Please help me.

  3. I like to keep my sites down to 5 plugins and I had already exceeded that. I am especially happy that your code worked. There are so many other codes out there that worked on some browsers, but not all. One code I used from elsewhere caused Safari to download the swf. A lot of people get pretty upset when something spontaneously downloads. So thanks! This is SUPER!

  4. Hi i am using this plugin, but the problem is that. when i open the page in chrome everything is good.but in firefox not showing anything

  5. that last comment should say: I had to wrap my code in pre tags to prevent WordPress from formatting it (and thus breaking it).

    • Iframing does, for sure. Just need for a browser… Iframe is easy to code and fully compatible. I don’t know why is not the popular way. I do it also with PDF files…

  6. hi all,

    i have a difficulty embedding any flash with any plugins for that matter, into my widget in my website, header..

    any suggestions will be welcome

    thanks

    • If you do not explain wich is that difficulty we cannot figure a solution for you. I guess you’re using a plugin funcion over another plugin funcion. Like “use shortcode in a widget to call swf and call that widget with another shortocode”. When you play around widgets and functions some thins are missing, but you can add it later, always.

  7. I checked on this plugin and was disappointed to find that it is over two years old and is no longer in use with WordPress. In fact it is incompatible….this is disappointing.

  8. You code worked perfectly. I had been trying to get the swf movie to load and play when someone comes to the page and your code was the first to work. You might edit or put a version of the code with out the numbers so newbies know not to leave them in.

    But thank you.
    Jeff “Foliage” Folger

  9. you should use
    wmode=opaque
    if you don’t need transparency.
    it’s much faster and has the same effect to “overlapping”.
    ;-)

  10. It’s 2012… no one should be embedding Flash into their WordPress site, or any website for that matter!

    • Oh please, what if I made a flash animation and wanted to embed that? Or something just for fun. I’ll agree flash isn’t that good, but no reason to hate it that much. It’s hardly useful, but still fun.
      I find drawing everyday vectors/cartoons much easier on flash than photoshop.

    • What ?! So because we’re in 2012 people shouldn’t post animations they’ve made with flash into the web for example ?

    • dude where do you live? every big company invests millions in serving flash banners in 3 standard sizes. Actually I am just working on one of them now. Do some research.

  11. hmm i never really tried to embed flash in my posts…but never the less i will bookmark this for future use…i mostly use youtube to show off my videos..thanks for d tut!

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.