I'm developing a gallery plugin and I was wondering if I could add a YouTube and Vimeo "embed" option to the media uploader to be able to add YouTube and Vimeo videos as attachments to a post instead of uploading the video files directly to the server. I'm thinking along the lines of an option with a textarea where one could put the YouTube or Vimeo HTML embed code and this would be added to the media library with a mime type of "text/html".

Any clues would be much appreciated


2 Answers 2


Attachment represents a file on your server that you may include its url in your content. All attachments are supposed to be in the media library. It is easy to see that by this definition your idea doesn't fit the wordpress attachment model (images that are off server are not attachments).

Your idea has merit but since it doesn't fit the wordpress model right now (version 3.7) I am not sure how easy it will be to implement it.

  • While this is not my area I am pretty sure there are plenty cloud-ish setups for WP where media is stored in Amazon S3 and stuff. This should be very doable.
    – Rarst
    Nov 16, 2013 at 16:48
  • maybe, but I think most solutions do it in three steps 1, upload to the server, 2. offload it to S3 3. change urls of the attachments being served from server urls to S3 urls. I am 99% sure that youtube has API with which you can mimic this but don't know about vimeo Nov 16, 2013 at 16:59
  • Some cloud setups might not have any local storage. As above - I hadn't worked with this in practice, but I think it's interesting question that shouldn't be easily dismissed as impractical.
    – Rarst
    Nov 16, 2013 at 17:03
  • it is not very practical not because files are not on the server but because the attachment mechanism assumes that attachments has URL and including an attachment in a post is by adding some wrapper around it. here we don't have a file but an html code without a URL, it just doesn't fit. you can probably hack something to make it work and I would be interested in seeing the code for that but I'm not sure it is the easier way to do this. Nov 16, 2013 at 17:16

The OEmbed in Library plugin shows that it can be done. It just lacks a link on the media uploader.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.