How to Attach Images to the WordPress Native Gallery

Dealing with images in WordPress can be a big pain in the butt.

Management of images and other assets is achieved through the Media Library. There is a link for that to the left of your WordPress dashboard.

You can also get to the media library when you insert images or other media (audio, video) into your posts by using one of the Upload/Insert buttons in the Edit Post screen.

The key issues with native WordPress 2.8 image management

  1. An image can only be attached to a single post. If you want to attach an image to multiple posts and have them appear with the gallery shortcode, then you must download the same image multiple times into the media library and attach each unique instance to a post.
  2. Attaching images to posts is often awkward and time consuming. There is no clear way on how you can select a set of images, and then quickly assign them to posts. This is what we will discuss below.

Note – The process to attach images within the WordPress native library described below is still awkward. To simplify this common task, I just created a simple Media Library plugin which streamlines the process of attaching images, re-attaching images, and removing image attachments.

How to Attach Images to Posts in Bulk (WordPress 2.8)

The easiest way I have found to attach images in bulk to a post is to do the following –

  1. Go to the Media library from your dashboard.
  2. Click on Add New and load in all the images you want. Happily you can easily select and download multiple images here from your local computer. All images loaded in this way they will be unattached.
  3. Now click on Library. The images you just downloaded should now appear in your WordPress media library.
  4. Click on Unattached, which is one of the options at the top of the media library. This will show you all the images that are currently not attached to posts.
  5. Select all the images you want to group to a given post. Currently, the only way to do image grouping in native WordPress mode is by tying them to posts. Therefore, create a post for each image grouping/category that you want.
  6. There is a drop-down menu at the top that says Bulk Actions. Click on that and select Attach to a Post. Then click on Apply.
  7. You will be presented with a pop-up that lets you search for the page/post you want to attach the images to. Click on the post/page you want to attach the images to and then hit the Select button on the bottom right of the pop-up.
  8. Once WordPress has attached the images, you will be returned to the Media Library, to your list of unattached images. You can continue attaching images in bulk by using the steps above.
  9. You may also want to check that your images have been attached correctly. Click on the Images filter at the top and scroll to the images you just attached. The post you just attached them to should now appear on the Attached-to column.
  10. After you finish creating all your image groups, you may insert one or more groups into your WordPress posts by using the WordPress gallery shortcode

There are other useful options associated with the gallery shortcode, so make sure to check out the codex link above.

Once you have attached an image to a post, there is no easy way that I know of to re-attach it to a different post. What I do now, is just delete them and reload them again using the steps above.

If you want to attach an image to multiple posts then you must load it in multiple times (as of WordPress 2.8).

Why Use the WordPress Native Gallery?

Instead of using the WordPress media library and gallery, you can also use a fully featured image plugin such as the NextGEN plugin.

The advantage of using WordPress native functions is that you can be sure they will have continued support over time. In contrast, many standalone plugins get abandoned over time and may no longer work with new versions of WordPress.

In addition, there will be a larger range of plugins that enhance the native functionality.

For example, you can download a variety of plugins that enhance the native WordPress gallery display including LightBox, ShadowBox, FancyBox, Galleria, and many others.

Plugin to Simplify Image Attachments?

At the writing of this article, I could not find a plugin that simplified the image attachment process. In particular, I want to –

  • Attach the same image to multiple posts.
  • Attach images to Category and Tag objects.
  • Easily detach and re-attach images from posts, categories, and tags.
  • Expand the gallery shortcode to display images from Categories and Tags.

** I have since written a Media Library Plugin for facilitating all of these operations.

Related Articles


  1. says


    I am trying to insert images through a php script. I want to attach them with my posts. I have added a new entry into wp_posts table, and they are showing in the post media. But images are not appearing. But images are in folder and I have checked that. I am not creating any thumbnails. I am just copying original size images. So, is there any way so that I can view images in media as well.


Leave a Reply

Your email address will not be published.