I’m Quite Proud to Present Attachments 1.5

Posted: October 12, 2010 Comments(62)

If you follow me on Twitter, I’ve been yapping a bit more lately about Attachments, my WordPress plugin that lets you append assets from your Media Library to Pages, Posts, and Custom Post Types in a very simple way. Until now, Attachments has used it’s own method of browsing and inserting media, but I’ve always wanted to refine the process a bit. I’m glad to say that in 1.5, it’s definitely refined.

There’s now a single action to upload and attach assets:

Screenshot of Attachments

Clicking the Attach button now brings up the very familiar, WordPress native browse modal dialog. You can upload directly in line, and also attach your media straight away!

Screenshot of Attachments

You also have the option of browsing and searching your existing media:

Screenshot of Attachments

You can continue attaching media, and once you’re done, just close the dialog and your Attachments are ready to go:

Screenshot of Attachments

I’m really liking the new user experience this change brings about, but I’ve already discovered some bugs I’ll squash over the next few days. If you haven’t yet, check out Attachments, and if you have a minute I’d love a rating and a confirmation that it’s working in your install!

Get my newsletter

Receive periodic updates right in the mail!

  • This field is for validation purposes and should be left unchanged.


  1. Nice Job.

    I always thought this was a strange part of the wordpress user experience. It looks like it can now be much better.

  2. Thanks for closing the loop on that part of the functionality, this is such a great plugin!

  3. Nice work on this. I need this functionality on a previous website I worked on and find anything that suited my needs. I ended up writing a very quick Attachments plugin to suit my needs, and had planned on writing a full featured plugin for public release – now I don’t need to as looking at yours, it seems to handle my needs very well, and in a much better manner than I had planned. Thanks

  4. Nice. I’ve been vaguely looking for a plugin like this for years. This seems like a nice addition. The UX looks simple enough for most clients. I’ll add this onto my next site and leave a comment on the plugin’s page. Cheers.

  5. Thank you so much for creating this plugin. I have actually been trying to accomplish this all day today when I randomly came across your website on a totally unrelated search.

    I have one question about the plugin. Why don’t you store the attachment relationship using the built-in data structure? It appears that you’re just serializing the attachment data into a custom post meta field.

    This was very confusing for me because the attachments created by your plugin aren’t reflected (or editable) via the built-in media library.

  6. You’re very welcome, I’m glad you found the site! I purposely strayed away from injecting Attachments’ data in such a way as to prevent unwanted functionality with other plugins or WordPress itself. I’m still weighing the pros and cons of including the data on such a tight level with WordPress itself, I’ll consider your note a +1 for the feature request pool. Thanks very much for the feedback!

  7. Hi Jonathan,

    I really like your plugin as I wanted to write the same plugin. Gladly you have done it already!

    I’ve noticed that you missed the textdomain in attachments.options.php
    <?php _e("Attachments can be integrated with your Custom Post Types. Unfortunately, there are none to work with at this time.”); ?>
    should be:
    <?php _e("Attachments can be integrated with your Custom Post Types. Unfortunately, there are none to work with at this time.”, “attachments”); ?>

    I also prefer to use single quotes instead, as they are faster then the double quotes.

    Thx for the plugin


  8. This is definitely a very refined plugin. Works great and really easy to implement into a theme. I was looking for a way to attach an image to multiple posts / pages and this does the trick…. VERY well. Great work!
    For me the only snag has been being able to pull out different image sizes that wordpress creates. Would be great if the plugin could return the thumbnail, medium and large locations of attached images also. Aswell as any custom sizes. I know this is a big ask but it would be a huge addition to this plugin.
    I’ve looked at adding additional code to the location ie. image1-700×200.jpg but in tests where the image is uploaded at the right size wordpress has no reason to attached the suffix of image size to the and image or create another image for that matter.

  9. hi, i’ve tested your plugin with wordpress 3.0.1 but when i attach a file to a post i see the file attached only in the admin panel, while on the site don’t appear the attached file.

    Please, help me, thanks

  10. Great plugin, I have been looking all over the web on how to upload media attachments in a meta box, but this more than fits the bill!

    Is there anyway to restrict which pages or posts the attachment plugin metabox is included on that you could suggest?

    Thanks for this plugin, brilliant!

  11. This is the first request I’ve received to restrict where Attachments appears on a per-page basis, but I’ll add it to the running list of feature requests I’ve received. Thanks!

  12. I think at a minimum we need the ability to define if the metabox should be included on the default post, page and/or to including or not include it on any custom post type. Doing it on a per page/post basis would of course also be excellent… In all cases maybe just so we can easily define/extend it in the code.

  13. Ok, love the plug in and have added to our new site., thank you for your hard work.
    I have added the code to the theme page. But all I get is a link to the picture. Not the picture itself. Any recommendations to show the attachment as a picture if it is a picture?

  14. Hi Jonathan, Great plugin! I actually extended it on one site to allow me to post multiple attachment galleries in a single post.

    I’ve come accross a slight problem, I’ve got 3 custom post types registered, yet I am receiving this message:

    Attachments can be integrated with your Custom Post Types. Unfortunately, there are none to work with at this time.

    What am I doing wrong?


  15. Ignore the above comment, it turns out you just need to set ‘public’ => true as one of your custom post type arguments!

  16. the plugin is so great that i decided to use it instead of the featured image. why?

    being the type of person who likes to dig into the source code and edit where i feel suits my requirements, i have added an extra text field to the attachment plugin called groups which works as a category for attachments.

    the groups that i have in my theme are: banners, thumbnails, downloads.

    Now i can have each group to be positioned somewhere different in my theme or atleast thats what i thought.

    the problem i am facing is somewhere in my query as it only displays a list of the first group.

    my attempts are all work in progress and would be greatful if you can help me achieve what i am trying to do

  17. Great plugin, exactly what I was looking for.
    A +1 for the “store the attachment relationship using the built-in data structure” request, or almost it could be an option.
    Just one point, it seems to be needed to save the post or page to retain the changes done to attachments, and you don’t say it in this post. It got me nuts the first three times I attached something.
    Great work in any case.

  18. Hi Jonathan, I like the idea of making the ‘upload media’ form more visible. I installed your plugin and saw the panel for adding attachments.

    However, as far as I can tell, the panel added by your plugin does not display existing attachments for the page. By existing attachments, I mean media that would have been uploaded using the wp-core ‘Upload/Insert’ dialogue. Screenshot: http://cl.ly/3L0m0x2b1E1W3y0J3H0j

    Also I noticed your upload form has different fields than the native WP form. Another nice feature that I’ve been looking for in a plugin but have not found, is an interface for adding fields to the media upload form. E.g. http://wpveda.com/adding-custom-fields-to-wordpress-media-gallery-upload/. It would be nice to not have to open functions.php to do that.

    Just some ideas, great work!

  19. Brilliant plugin.. Thanks.. Movable Type has this nifty asset feature and this pretty much matches the functionality

    Although fully working on other pages, it stalls my homepage and eventually crashes it. Somethings infinitely looping.. seen it before? any ideas? Thanks

  20. It sounds like there may be another plugin causing the issue, especially if it’s working fine on other pages. I’d suggest disabling your other plugins and re-activating them one at a time until you can narrow down the issue.

  21. Great plugin thanks.
    I’m working on a Document Management system wordpress intranet site.
    Do you thing it would be possible with your plugin to change the file upload location so it can reproduce the internal structure of the already existing system of files who need to be attach.

  22. hi there,
    I have a problem – I watched your video tutorial and it looks completely different now. I only get this media library window, and there’s a message saying to tick all images I want to attach. But there are no tick boxes, unfortunately. I deactivated all other plugins to see if sth else is blocking it but no, tickboxes just aren’t there.

    But whatever, it’s still OK to attach images one by one. The problem is that my media library doesn’t ‘see’ the attachments – next to the image I just attached via your plugin to some page it states ‘unattached’. Also when you look at the page/post itself it says that there are zero attachments to the post after I attach stuff. Why is that, do you have any idea?

    Am I the only one with this problem? Maybe something is wrong with my media library? Because when I click on “unattached” status of a picture in media library, a little window pops up with a choice between pages and posts and also a search box, but nothing shows in the window I am supposed to see the pages or posts in…

    Please help, I’m getting sooo frustrated with this media stuff…

    Thanks a lot.

  23. Yes, the original screencast was from a very early version. I’m planning to update it as soon as possible, but I’m honestly not sure when that’s going to happen. For the time being, bulk adding is no longer available. If you’d like to use an old version of the plugin (pre 1.5) it should work just fine.

  24. Additionally, the plugin doesn’t hijack anything in regards of attaching assets to objects on a WordPress level because technically you haven’t done that, the relationship is stored in a different way. There have been a number of requests for that feature, so it will be an option in an upcoming release.

  25. Hi,

    I love your plugin. It should be adopted in the core!
    I only need it for some custom post types, so I want to disable it for the pages and posts. Is there a way to do this? Maybe an update so you can turn them off in the options page?

  26. Working great on WP3.1… Thanks for taking the time to write such a handy tool.
    This is a silly question, but how would I return just the first attachment?


  27. Ok sat back and thought about it and then started to kick myself, sorry for the previous question. The answer was so obvious couldn’t see it..

  28. I understand that the whole idea of this plugin is not tying files down to one post but to enable the same file to be attached to a number of different posts.

    However, is there a quick way of modding the plugin so that attachments uploaded through a post automatically get “WP Attached” to that post? (ie. the Media Library shows the relationship between the file and the original post that it was first uploaded from?)

  29. This thing is fantastic.

    I’ve found it very simple to customize it slightly to add extra fields for each attachments. It’s become an essential plugin for me — thank you!

  30. Wow! I was literally about to dedicate countless hours of research and trial + multiple errors of development trying to create something similar for a portfolio theme we are developing now and I stumble across this post. This is one of the reasons I love the WordPress platform. Even if I think we have a great idea, the chances are extremely high that someone did, as well, and has already executed it in a manner I did not even think of.

    Quick question that is not a deal breaker. Can the meta box be associated with an exclusive post type or is it global? Since we are potentially going to use it to create a jQuery slideshow on a custom post type case study page, it’s only needed on that custom post type editor page. As I said, not a deal break by any stretch.

    Thanks again.

  31. Hey Erik, glad it saved you some time. There are Settings available for Attachments where you can turn the meta box on/off per Post Type (e.g. Posts, Pages, Custom Post Types) and you can turn it on/off at any time.

  32. So, I have installed this gem of a plugin and am ready to test it out to make sure this is the solution I am looking for. After installation and activation, I navigated to the Settings to check off my custom post type and deselect pages and posts. To my dismay, the only option that appears is for Devin Price’s Option Framework Internal Container (I will have to reach out to him to find out what that is). Here is a screenshot of what I see.

    My question for you, which may be out of scope for support for this plugin, is whether or not I need to do anything explicitly with my custom post type set up to support this plugin? Secondly, should there be options for disabling Pages and Posts on this screen as well or did I misunderstand that?

  33. Interesting, it’s likely due to the way Options Framework implements Custom Post Types, it may be doing so under it’s own hood in some way. I’ve spoken with Devin in the past, I’ll reach out to him and see what the deal is.

    Yes, you can disable on Pages and Posts in addition to Custom Post Types, but not until version 1.5.3 is released, likely this weekend!

  34. Just committed Attachments 1.5.3 which brings back Post and Page on the Settings screen. You’re seeing that additional ‘Options Framework Internal Container’ because that particular plugin is using a Custom Post Type to store its data. While not a show stopper, I’m going to think about ways to hide Custom Post Types like that, but it’d be tough to determine which are wanted and unwanted since many people also use plugins to create their own Custom Post Types. Either way, if you upgrade to Attachments 1.5.3 you’ll see Pages and Posts on the settings screen, as well as any additional Custom Post Types you add.

  35. Would it work to just display custom post types that have ‘show_ui’ set to true? Let me know if you want me to dig through your code a bit- might have some time later this weekend.

    Also, nice work on this. Seems like a super useful plugin.

  36. Hi Jonathan !
    Great plugin ! btw, how can i display the images attached ( bigger than 600 px height and width) to a square 120px x 120px without streching….?

    i hope you can answer me 😉
    Best regards!!

  37. Hi Jonathan,

    Great plugin, i use it on almost every WP site i develop.
    For one of those sites there is a small issue:
    When i want to attach an image to a post and im searching in the media library, the option to attach is gone :S
    I can only place it in the content…… any idea what happened?
    WordPress version 3.1.4 with latest attachment version.


  38. Hi Jonathan,

    this is a great plugin and I love it. Therefor I have done the German translation of it. Please leave me an mail address where I can send this to.

    There’s one thing I would like to see in this plugin too. This would be a link which can be added to each attachment individual. In my case I use a Custom Post Type with attachments for a slider where each image has to link to a page. For this I use actual the caption of the attachment but I think it would be better to have an extra option for that.

    Hope to see this in an upcoming version.

    Thanks for your great work

  39. Hi Jonathan,

    I’m using the attachments plugin for a project at work. I’m using it a little differently than many of the people in this forum, as I actually don’t intend for it to work on the front end of the site.

    We use WP as a document management area using the Document Revisions plugin, and I’m using your Attachments plugin to allow contributors to attach images/audio/powerpoint files to documents.

    The plugin works, but I’m wondering how I can get it to display the url of the uploaded assets on the attachments screen. The primary purpose is to be able to download the assets that others have uploaded. I can get the url by accessing the media library, but I’d like it to display this info under every uploaded asset.

    For instance, I would like to be able to see beneath each attached file: http://somesite.com/wp-content/uploads/2012/04/93116071.jpg

    Is this possible?

Leave a Reply

Your email address will not be published. Required fields are marked *