Creating a Photo Gallery in WordPress
Many people get confused when trying to create a photo gallery in WordPress. It isn’t obvious at first glance how to utilize this built-in feature. Let me walk you step-by-step through how to create a photo gallery by uploading images from your computer or by using images already in your media library. Just in case you need a little more help, you can follow along with the video!
Prerequisites to Your Photo Gallery
It is important to understand that before you can create a photo gallery in WordPress, you must first associate at least two images that you want in your gallery with the post or page where it will appear. The best way to do this, is to go to the post or page where you want your photo gallery and click on the ‘Add an Image’ icon at the top of your editing area.

You will be given the option to add an image from your computer, from a URL or from your media gallery. Images added via URL are not actually associated with the post or page, so this method is not an option.
Uploading Images
If you want to attach multiple images to your post or page simultaneously, you want to use the ‘Upload From Computer’ option. Attaching images from the media library to your post or page is possible, but not recommended. I will go into more detail on this later.
A search engine optimization (SEO) sidenote: You will want to be sure that the image file names contain relevant keywords before uploading them to WordPress. You will also want to be sure you use descriptive keywords in the “Alternative Text” box for each image.
Once you have uploaded at least two images to your post or page and clicked on the ‘Save all Changes’ button that appears, you will see a ‘Gallery’ tab appear. Click on this tab to configure your gallery settings.
Inserting the Gallery
Once you are on the gallery tab, you will be able to edit any details for the images and select some options for your gallery.
Let me explain the options available when configuring your gallery:
- Link Thumbnails To – The options here are ‘attachment page’ and ‘image file’. This option determines the action that takes place when a user clicks on a thumbnail in your image gallery. If you select ‘image file’, the user will be taken to a page that displays the full size image. If you select ‘attachment page’, users will be taken to a page that uses your website’s theme, displays the photo, and allows them to comment on the photo.
- Order Images By – The options here are ‘menu order’, ‘title’, ‘date/time’, or ‘random’. The menu order option allows you to put the thumbnail images in your gallery in any order you want using the drag and drop feature (or by numbering the images if this feature is not available to you). The title option sorts the images by the image title. The date/time option shows images ordered by the date and time that they were first uploaded. The random option loads the thumbnails in a different order every time the page is loaded, in case you just want to mix things up.
- Order – The options here are ‘ascending’ and ‘descending’ and allow you to reverse any of the previous selected sort orders.
- Gallery Columns – This is fairly self-explanatory, but this option allows you to select how many columns of thumbnail images you have in your photo gallery. In other words, the number of images from left to right in a given row.
Now that you have selected the settings that work for you, go ahead and click the ‘Insert Gallery’ button!
The Media Library Method
NOTE: This is NOT a recommended method!
There are a lot of people who use WordPress’s built-in media library to keep up with their images. Often, people ask how to create a photo gallery using images that already exist in their media library without having to re-upload them. In order to do this, you must associate the images in the media library with the post or page where you want your gallery to appear. There are two ways of doing this:
- Insert the image into your post or page from the media library. This associates the image with your post (or page). Since you are creating an image gallery, you probably don’t want the full size image to appear in addition to the gallery. So you must delete the image from the post after inserting it. Don’t worry… it is still associated with the post and will appear in the gallery.
- From the media library, find the photo you want to associate with a post and click the ‘attach’ link. Search for the post or page by name and then select the appropriate one.
Be aware that there are some limitations and risks associated with using this method:
- Each image in your media library can only be attached to a single post or page.
- The only way to remove an image from a gallery on a particular post or page is to delete it. Deleting the image removes it not only from that particular gallery, but the media library as well. If the image was being used elsewhere, it will no longer be available.
Future Changes
You can always make changes to your gallery settings later by clicking on the gallery placeholder (from the visual editor, as opposed to the HTML editor) and clicking the small icon that appears in the top left corner.
Deleting the gallery is as easy as clicking on the placeholder and hitting delete.







Thank you for your fab info! I have clients that paid to have all this done and I just wanted to know a bit of the items you share!
Your instruction is very clear, good job. But I have a question that bothering in my mind. What if I have a existing images and I already used it in other gallery but I want it also include to another gallery. How Can I include the existing picture to other galley.
Any images that are in the media library are available to be used elsewhere in WordPress. If you upload an image to a particular post, that image is also uploaded to the media library. My only word of warning about using the same image in multiple galleries is to keep careful track of what image you have used and where. If you were to delete an image to remove it from a gallery, it could have been used elsewhere as well.
For this reason, I would recommend just uploading another copy of the image and using that copy in your new gallery. This will allow you to manage the image in both galleries separate from each other.
Thank you so much for this article, I wasted several hours on this and got nowhere . . . I really appreciate you taking the time to explain this . . . I kept feeling like there must be something I was missing and sure enough there was.
Thanks again,
Kirk
How can I create 2 different gallery in 1 post? I found there is no issue to have 1 gallery, but if I want to have 2 gallery, it can’t be done.
Mohd, this is one of the limitations of using the built-in WordPress galleries. Because any picture associated with a page or post appears in the gallery, it is not possible to have separate galleries without using a plugin.
Thanks Micah. Really appreciate it.
It doesn`t show columns with thumbnails. Only the big picture, like a flash.
Are you sure you added the gallery and not the image? Also, be sure you have added more than one image to the gallery.
How can i add a deferents galleries on each single page??? May i use the same short-code??
You can use the categories to organize your promotions and can pull a specific set of promotions into a slider using the shortcode, like this: [promoslider category="homepage-slider"]
The Promotion Slider allows you to run multiple sliders on a page.
Im traying to make a Gallery on my product page of (WP e-commerce) but I CAN’T!!!! Why???
I was trying and trying and trying!!!! AAaaghhh!! :@
Im traying to make a Gallery on my product page of (WP e-commerce) but I CAN’T!!!! Why???
I was trying and trying and trying!!!! AAaaghhh!! :@
WP E-commerce has changed how the image uploads are handled in their plugin. Rather than have the normal ‘Gallery’ tab, they have a ‘Product Image Gallery’ tab. This new tab doesn’t actually give you the ability to create galleries as far as I can tell, but just gives you a place where you can see all the images you have uploaded for a particular product.
However, this doesn’t mean that they have disabled WordPress galleries in the product creation screens, just your ability to create them. You can cheat the system by adding in the
[gallery]shortcode. Just drop that shortcode where you want your gallery to appear in the products page and as long has you have more than one image appearing in the ‘Product Image Gallery’ tab, you will see a gallery with all your images for that product. You will have to adjust your gallery settings manually through the HTML editor after you add it.On a side note, if you are using an older version of the WP E-commerce plugin, you won’t be able to do what I mentioned above.
how do I delete an image from a gallery that is already embedded in the webpage? if i delete it will it be deleted from the page?
Unfortunately, WordPress doesn’t really provide a way for you to unattach an image from a post. If an image is attached to a post, it will automatically show in a gallery on that post. The only way to remove an image is to delete it. Unfortunately, it is also not possible to have one image appear on its own in a post and not to have that image appear in a gallery (if a gallery exists). I am thinking about writing a plugin that would allow you to unattach an image from a post, thereby removing it from the gallery.
yeah, dont delete if from the gallery or esle it is deleted from the webpage also. whats the solution?
I did it…!!!!! Thanks a loot!!!!!
Now I have my products and my galleries too!
Thank you Siiii’ muchhhh!!!
Pingback: Blog theme redesign – University Blogs
This was a really helpful and effective tutorial: very many thanks.
I’ve now successfully created several photo galleries on my site. But beneath each photo appears the text “Comments are closed”. This is nuts for a site that’s not intended as a blog: how can I remove this text?
Unfortunately, the comment bit is probably hard coded in the attachments.php file in your theme. Removing it would involve editing that file. However, as an alternative, you could link each thumbnail to the image file rather than the attachment page. This can be configured on a per gallery basis and can be found in the gallery settings. See the screenshot above under the ‘Inserting the Gallery’ heading for an example.
Many thanks for your help. I’ve now found a solution (spending ages working on a child file copy of the original wordpress theme). I removed the words “comments are closed” from the comments.php file, leaving the single quotation makrs undisturbed. Seems to do the job!
As a complete newbie to websites and associated software, I have to say I’m astounded at how nerdy and primitive the whole business remains: it feels like the days when the only way you could do something on a computer was to write your own program in BASIC! Will the day ever dawn when one can set up a website with a simple GUI that does everything, instead of just some parts of the process?!
Thanks once again for your great thread and your rapid response.
Glad to hear you got it working. WordPress has made creating websites much easier than it used to be, but there are still some elements that are evolving. Themes would be one of those. There is a huge difference in the functionality and professionalism of the themes available in the WordPress repository and elsewhere.
Thanks for the article. This is the first article i read that brings some liht to the built-in gallery features and its limitations.
Let us know if you develop the plugin so as to ‘dettach’ images from the gallery!
Best.
This has been extremely helpful; thank you very much! I have been looking for a gallery plugin that allows comments on each image for a client’s website for quite some time, so it’s great to see this can work without any external coding.
I do have one issue, however. Since I want viewers to comment on images, I have the gallery set to forward to the attachment page, but since my theme doesn’t have an attachment.php file, it is showing “comments are closed” under the image. I’m not sure how to change this since I don’t know where this code is being brought in from. Is there something I’m missing, maybe?
Kind regards.
It could be that you need to check your settings under ‘Settings’ -> ‘Discussion’ to be sure that you are allowing comments. I would imagine that you are allowing them, but I am not sure since Disqus may handle things a little differently.
If you don’t have an attachment.php file, then your single.php file will be handling it.
Thank you very much for your response! I figured it out late late last night… I actually wound up having to download a plugin that allowed comments on individual images. My single.php was working fine, but the comments weren’t active even though they were turned on everywhere in the back end.
I appreciate this post, and your quick responses. Great job!
Great post – perfect as I begin bldg my site. Have a question: I would like to use a photo gallery as a Table of Contents to individual pages or posts, so for example each might be a pic of an entree or dessert and clicking on the thumbnail would take you to a page with the same pic plus content that might include the recipe. I’d like to do this so that it is not must me writing in the comments section but so that it links to an actual page/post. Is this possible with the WP Gallery? If not, do you know what plugin would allow it – I also checked NextGen Gallery but it doesn’t seem to allow that either? Thanks!!
You can have an image link to any URL you want, but the galleries in WordPress only allow you to link to the image or attachment page for that image. I have a plugin called Promotion Slider which would allow you to create a slideshow of featured content and have that automatically link back to the original post. Perhaps that would be something close to what you are looking for? It is a slider, not a gallery, but it would automate the insertion and linking of the images within it.
Does this gallery support custom images?
I found that it just uses all images.
The galleries in WordPress currently display all images that are attached to a page or post. Currently, you are unable to insert images into a post and have separate images appear in the gallery.
Hi, I want to have one gallery on each page with different photos which I thought I could do but how do I clear the previous gallery (without deleting the old one from my media files) so I can build the new one with different photos?
Thanks.
Sophie, I am not entirely sure what you are asking. Are we talking about individual pages, or paged content here? WordPress galleries pull in all the photos that are attached to a particular post (or page). However, if you are referring to paged content, then any images attached are still part of the same post / page.
Sorry, I will try and explain better. I have a website with static pages. On each page there is a couple of photos amongst the text that are unique to that page.
At the bottom of the page I would like to create a gallery of different photos that are also unique to that page and to that gallery.
Is there a way to clear the gallery in order that I can make a the gallery at the bottom of the page please without deleting the other photos off their correct part of the page?
I am sure that is as clear as mud so if you go to this page I hope you may understand better.
http://horseridingtauranga.com/holiday-programmes/
Under the final heading of “Highlights from Past Holiday Programmes” I wanted to put a gallery but the other photos from above show in it so how can I stop this without deleting them from the media files?
Thanks for getting back to me so quick and for the help.
Oddly enough, what you describe isn’t something that you can do with the default WordPress photo galleries. All of the photos that are attached to a post or page are shown in the photo gallery and there really isn’t any way to control this. However, there is a way around it… any images that are included on the page via URL are not officially attached to the post (or page) and are thus not included in the gallery. You could upload images to the media library and then include those images via the URLs on a page. Then, you could upload images within that post or page (without inserting them on the page) and these would appear in the gallery. I agree that there should be more control over this, but this is a workaround. Of course, if you really need advanced gallery control, you can always find a plugin that allows you to do what you want.
Thank you so much for your help- that is brilliant. Weird this hasn’t been sorted as I am sure I am not the only one who would like to do this!
Thanks again, you have been REALLY helpful.
Sophie
after i create a gallery of photos, how can i set them up so they can be visible on search engine “images”. for instance when someone searches for “portrait paintings” on google or the name of the artist. i want for my gallery to be visible on google images
Ana,
WordPress doesn’t index image galleries, just individual images. There are a number of things that can help your images rank in Google Image Search. I have put together a quick post that goes into some of these things: Optimizing WordPress Images for Google Image Search.
This is one of the best articles so far I have read online. No crap, just useful information. Very well presented. Thanks for sharing with us. I have found another nice post over the internet related to this article which have also informative information and explained very well.
check out the following link for more details about that post.
http://mindstick.com/Articles/44501281-fd03-410b-ad37-9aaa651ff0f8/?Creating%20and%20Using%20Media%20in%20WordPress
Hello there
Stumbled upon your site as I was getting lost in the sea of help online…
I’m having issues with my wordpress gallery where even though I have checked the option of ‘view full size image’, only the thumbnail shows up.
Btw, clicking on image size ‘large’ isnt possible as well..
Any suggestions please? Thanks!
By default, WordPress galleries only display thumbnail images. Clicking on the images takes you to the full size image. The reason that ‘large’ isn’t an option is probably because the original dimensions of your uploaded image are smaller than that of the large image size.
Hi,
Very nice site, with clear and helpful answers.
I am a complete novice setting up a retail selling site for myself using wordpress and monkeying around with twentyeleven to see if I can get it to do what I want. Here’s the question:
I’d like to have a page (or pages) with a thumbnail gallery of items for sale, with the thumbnails linked to more images of the item with description etc.
The gallery view lets me link a thumbnail to an attachment page, but that page seems only to allow the full size version of that one image, and also has a comments section that I do not want. Can I modify the attachment pages to permit additional photos and eliminate the comments section, or am I barking up the wrong tree?
Thanks, Steve
You are barking up the wrong tree. You would want to create a custom post type ‘products’ that would have featured images as the main product image. On these product pages you would setup your WordPress photo gallery to display the additional images of each product. Finally, you would create a custom template that would display the featured images in a grid format, similar to the photo gallery… except these would link to the product page for each product. If you need some more help with this, just shoot me a direct email via the contact page.
Hi Micah,
Found your post via Google.
I’m Joan, the woner or Artically.com
When I create a new post with a gallery I want it to open a new attachment page. Like this: http://brosome.com/bugatti-veyron-grand-sport-bumblebee-edition/
But when I create a gallery on my site, linking to a “attachment page”, and I clic on a thumbnail (after I create the post), the pages loops/goes back to itself and does not create a new attachment page.
Example: http://artically.com/estilo/boys-toys/traje-stormtroopers-star-wars-fibra-de-carbono/
What could be the problem?
Joan,
You may have a plugin that is automatically redirecting attachment pages to the image. I am assuming that you have correctly linked to the attachment page and not the image itself, since I can’t see your settings.
Hi again.
You were ritgh. Yoast SEO Plugin was redirecting the galleries.
Now the gallery is creating the attachment page (AP). But in the in AP the image is a thumbnail and not the full image besides on the AP there’s not gallery like on this post:
http://brosome.com/bugatti-veyron-grand-sport-bumblebee-edition/bugatti-veyron-grand-sport-bumblebee-edition-1/
This is my post in comparition:
http://artically.com/estilo/boys-toys/traje-stormtroopers-star-wars-fibra-de-carbono/attachment/traje-stormtroopers-3/
PD.: Thanks for your help
The attachment page is generally a template within your theme. Whether the gallery appears on an attachment page and what size image appears would depend on how that template file is configured.
Hi,
I want to do a picture gallery where any picture links to post, but when I update the picture on gallery and cancel the link url it doesn’t work. How can i fix that?
@shiomi,
It sounds like you are trying to change the link url for any image to a custom URL that corresponds to a specific post. It sounds like you are changing the URL in the correct location, but for some reason it isn’t working. It should work, so if it isn’t there could be something corrupted with your WordPress installation, a plugin or theme could be causing an issue, or I am misunderstanding you and you may be trying to go about changing the URL incorrectly.
If the issue is with WordPress, doing a manual install or upgrading to the latest version if you haven’t already should fix it. If it is a plugin issue, you can verify it by deactivating all your plugins temporarily and then checking to see if you can make the change. If it is a theme issue, you can change to the default WordPress theme temporarily and try again.
Hello
Thanks for getting back to me and you’re trying to help, it’s terribly important to me
I try to post a gallery of images and link any image for another post
I downloaded a new installation of WordPress 3.3.1 and closed all the plug-and it still does not work
Always link back to the link of the image itself rather than changes to the link of the post that I want
I found a site http://geekeemedia.com/wordpress/add-a-custom-url-to-your-wordpress-gallery-images/
Claim plugin should resolve after you have installed it is actually saving the image Tlink I want
But once I’m up to and updating after I click the image appears an error:
You do not have permission to access / wordpress 2 / <a href = on this server.
What am I supposed to do all my site-based to a gallery of images on the main page and bereavement image link
Another post
I use warmserver
Please help me
@shiomi, if you don’t mind giving me access to your site, I would be glad to look into what is going on. Just shoot me a message via my contact page.
i stell dont have a website i workin on
wampserver i need to close whit go dady about the server and domin.
thh problam to link image from gallery to another post it so Angers
what i need to do ?
if you can do it and its work for you
Can you pass me Tgirsh or download link if you’re working with WordPress?
@shlomi,
Sorry, I misunderstood what you were trying to do. I thought you were wanting to link individual images to a specific post, not the gallery thumbnail images. WordPress doesn’t really allow this. You will probably have to use a gallery plugin that will allow you to provide your own link URL.
Thanks to the help
I want only images gallery code to create a simple page to wordpress.
@desi,
Sorry, I’m not really clear on what you are trying to do.
Hi,
Is there a way that my guest / users can upload images with there own pages? Just like a facebook.
Thanks in advance.
@jhun,
I highly recommend the Gravity Forms plugin if you are looking to have users post content from the front end of the site. It will allow your users to add content and upload images. Allowing users to create galleries is a very different issue. This does sound like it would be a cool feature to have, but I am not aware of anything that allows users to do this. Perhaps we have hit a great idea for a new WordPress plugin.
Hi Wood,
Many Thanks for the advice. I can’t wait for your new plugin and I’ll be the first one to install it. Again Thanx