How To Add WordPress Image Captions

Adding captions to images in WordPress is a great way to add context to your content and make it more engaging. Captions can also help with SEO, as they provide additional information about the image that can be indexed by search engines. Fortunately, WordPress makes it easy to add captions to images. Here’s how:

Step 1: Upload Your Image

The first step is to upload your image to the WordPress Media Library. To do this, go to the “Media” tab in the WordPress dashboard and click “Add New”. From here, you can drag and drop your image into the uploader or click “Select Files” to browse for the image on your computer.

Step 2: Add the Caption

Once your image is uploaded, you can add a caption by clicking the “Edit” link next to the image. This will open the “Attachment Details” window, where you can enter your caption in the “Caption” field. When you’re done, click “Update” to save your changes.

Step 3: Insert the Image into Your Post

The next step is to insert the image into your post or page. To do this, go to the post or page where you want to add the image and click the “Add Media” button. This will open the WordPress Media Library, where you can select the image you want to insert. Once you’ve selected the image, click the “Insert into post” button.

Step 4: Preview Your Post

Finally, you can preview your post to make sure the caption is displaying correctly. To do this, click the “Preview” button in the WordPress post editor. This will open a preview of your post in a new window, where you can check that the caption is displaying correctly.

And that’s it! You now know how to add captions to images in WordPress. Captions are a great way to add context to your content and make it more engaging, so be sure to take advantage of them.


A picture may be worth 1,000 words, but just a sentence or two of text accompanying an image as a caption can often help drive a point home. Eyetracking studies have shown that website users often focus on compelling, relevant images and follow up by reading related text in adjacent captions.

But, if it’s your job to lay out images and captions on a web page, getting those elements to appear together consistently can be tricky. That’s why, in this guide, we’ll dig into how to add WordPress image captions.

How to Create WordPress Image Captions

The relationship between an image and its caption can begin as soon as you upload it to WordPress. There are two common approaches to getting images and captions together:

  1. Create captions in the WordPress Media Library.
  2. Create captions in the WordPress Editor “on the fly.”

We’ll take a look at both.

How To Create Image Captions Starting From the Media Library

Images you add to the Media Library usually end up in folders on your web server, while information about the images — including captions — are stored in the WordPress database.

To access the Media Library:

  • Select Media > Library from the WordPress Dashboard.
  • Click the Add New button to upload your target image.
Screenshot: A new image being added to the WordPress Media Library.
Adding a new image to the Media Library.

Clicking on that image thumbnail brings up the Attachment Details window, where you can add your image caption.

Screenshot: Caption text being added in the WordPress Attachment Details window.
Caption text added in the Attachment Details window.

Add your preferred text in the “Caption” field and, voilà, your image caption is added. You may be happy to know that, when editing image details here, WordPress automatically saves your work as you type.

You can also jump straight to a media upload by selecting Media > Add New from the WordPress Dashboard:

  • Select (or drag and drop) the image to upload.
  • Then click the Edit link beside the image thumbnail.
Screenshot: Clicking the Edit button after uploading a new image in WordPress.
Adding an image after selecting Media > Add New.

Clicking Edit opens the window that includes the image caption field:

Screenshot: Adding caption text after uploading a new image in WordPress.
Adding a caption after starting an upload with Media > Add New.

That’s where you’ll be able to add your preferred caption. This time, though, you need to save your changes by scrolling down until you can click the Update button:

Screenshot: Saving changes after editing image caption text in WordPress.
Save your work after adding an image caption.

Now that you have captions stored with your images in the Media Library, you can easily feature them on a web page or blog post.

Let’s see how to do that using the block editor and the Classic Editor.

How To Add an Image With a Caption in the Block Editor

To add an image in the block editor:

  • Click the [+] icon to display the blocks panel.
  • Click the Image icon.
Screenshot: Choosing the add-image option within the WordPress block editor.
The Available Blocks modal.
  • Click the Media Library button.
Screenshot: Selecting Media Library as the image source in the WordPress block editor.
Choosing the source of an image.
  • Then select your desired image.
Screenshot: Selecting an image in the Media Library through the WordPress block editor.
Browsing the Media Library.

The image and its caption are added to your layout.

Screenshot: An image caption displayed in the WordPress block editor.
An example of an image caption displayed in the WordPress block editor.

How To Add an Image Caption in the Classic Editor

In the Classic Editor, you can add an image and its caption by clicking the Add Media button:

Screenshot: Selecting the Add Media button in the WordPress Classic Editor.
Adding media in the WordPress Classic Editor.

Once there, you’ll see the caption field on the right for you to edit. When happy with the text, click the Insert Into Post button.

That button will be labeled Insert Into Page if you are editing a WordPress page instead of a blog post.

Screenshot: Inserting an image into a post in the WordPress Classic Editor.
Inserting an image with a caption in the WordPress Classic Editor.

Your image and caption will be displayed back in the editor.

Screenshot: Caption displayed in the WordPress Classic Editor.
Image and caption displayed in the WordPress Classic Editor.

How To Create Captions Directly From the WordPress Editor

The beauty of software is that there are usually multiple ways to get the same outcome. WordPress and image captions are no exception.

How To Upload an Image and Add a Caption in the Block Editor

In the block editor, click the [+] icon and choose the Image block option:

Screenshot: Choosing the add-image option within the WordPress block editor.
The Available Blocks panel.

Next, click the Upload button.

Screenshot: Clicking the Upload button to add an image in the WordPress block editor.
Uploading an image from within the block editor.

Once you select (or drag and drop) your image, WordPress will place it within the editor. You’ll see the “Add caption” text below it.

Screenshot: Add Caption prompt in the WordPress block editor.
Placing an image without a pre-existing caption.

To add your image caption, simply replace “Add Caption” with your own words.

Note that the caption you create is not saved to the Media Library when using this approach in the block editor.

How To Upload an Image and Add a Caption in the Classic Editor

If you’re using the Classic Editor, upload your image by clicking the Add Media button:

Screenshot: Selecting the Add Media button in the WordPress Classic Editor.
Beginning an image upload in the WordPress Classic Editor.

Next, click Upload Files in the Add Media window to select (or drag and drop) your image.

Screenshot: Selecting the Upload Files tab in the Classic Editor's Add Media dialog.
Choosing to upload an image in the Add Media dialog.

Your new image will be uploaded to the Media Library and displayed as selected with a checkmark. Add your image caption in the Caption field available in the Attachment Details panel.

Screenshot: Adding a caption while uploading an image in the WordPress Classic Editor.
Adding a caption in the Attachment Details panel.

After writing your caption, click the Insert Into Post (or Insert Into Page) button.

Your caption will be saved along with any other details to the Media Library and appear with the image back in the Classic Editor.

Screenshot: Caption displayed after uploading an image in the WordPress Classic Editor.
A caption displayed after uploading an image in the WordPress Classic Editor.

How To Edit an Existing WordPress Image Caption

What if you need to change or update captions already added to an image? You can do that in just a few steps. Here’s how.

How To Edit an Existing Caption in the WordPress Block Editor

The block editor treats a caption like any other text. To edit a caption, simply click on the text and make your changes.

Screenshot: Editing an image caption like regular text in the WordPress block editor.
Editing an existing caption in the WordPress block editor.

Be aware that captions edited this way in the block editor are not saved with the image details in the Media Library.

How To Edit an Existing Caption in the WordPress Classic Editor

If you’re using the Classic Editor instead, click on the image to display the image-controls toolbar.

Screenshot: The image-controls toolbar in the WordPress Classic Editor.
Image-controls toolbar displayed for selected image.

Next, click the pencil icon to edit the image details.

Screenshot: Editing existing caption text in the WordPress Image Details window.
Editing a caption in the Image Details dialog.

Enter your new text in the Caption field and then click the Update button. This will save your new image caption to the Media Library and get you back to the editor.

Screenshot: Editing an existing caption like regular text in the WordPress Classic Editor.
Editing an existing caption like regular text.

Tip: The Classic Editor also allows you to edit captions just like other text on a web page. Just remember that captions updated that way are not saved with the image details in the Media Library.

How To Add Captions in a WordPress Image Gallery

You can use similar methods to add captions to images in WordPress galleries.

Adding Captions to a WordPress Gallery Using the Block Editor

The block editor offers the Gallery block as an option after clicking the [+] icon:

Screenshot: Selecting the Gallery option in the WordPress block editor.
Creating a new image gallery in WordPress.

In this scenario, we’re assuming this WordPress site is stocked with images and saved captions, so you’ll click the Media Library button.

Screenshot: Selecting a source for gallery images in the WordPress block editor.
Selecting Upload and adding captions manually would also be an option.

In the Media Library, click the thumbnails of the images you want in the gallery. Checkmarks indicate your selections.

Screenshot: Choosing images for a gallery in the WordPress block editor.
Selecting the images for a new photo gallery.

Click the Create A New Gallery button to continue.

As a final step before placing the gallery on blog posts/pages, the Edit Gallery dialog allows you to drag and drop images to change the order in which they will appear and to add or remove images from your selection.

Screenshot: Selecting the order of gallery images in the WordPress block editor.
Reordering the images chosen for the gallery.

When you are satisfied with the results, click the Insert Gallery button.

The Twenty Twenty WordPress theme used for this example superimposes the caption text on the associated image.

Screenshot: A gallery placed with image captions in the WordPress block editor.
A sample of an image gallery with captions in the block editor.

Adding Captions to a WordPress Gallery Using the Classic Editor

Here’s how to add an image gallery with captions using the WordPress Classic Editor.

Place your cursor where you’d like your gallery to be inserted, then:

  • Click Add Media.
  • Choose Create Gallery from the left-hand sidebar.
Screenshot: Selecting the Create Gallery option in the WordPress Classic Editor.
Selected images will be highlighted with checkmarks.

You can browse the images available for your gallery under the Media Library tab.

  • Select the images you’d like to use in your gallery (indicated by checkmarks).
  • Click Create a New Gallery.

Your selected images will appear in the Edit Gallery window. There, you can edit caption text for each one and, if you need to, you can change the order in which images are shown.

Screenshot: Selecting the order of gallery images in the WordPress Classic Editor.
Drag and drop thumbnails to change the order of images in the galley.

When you are happy with your gallery content and your image captions, click Insert Gallery.

Your images and captions will be displayed in the editor.

Screenshot: Using the Edit Gallery toolbar to modify image captions.
You must edit the gallery again to modify captions.

Note that captions can’t be edited in this view. To do so:

  • Click anywhere on the gallery to highlight the group.
  • Click the pencil icon.

You’ll return to the Edit Gallery dialog seen in the previous step, where you can again edit captions.

Changing the Appearance of WordPress Gallery Captions Using a Plugin

By default, WordPress uses just the Caption field stored in the Media Library when automatically applying image captions. However, the Gallery Image Captions (GIC) plugin provides a hook for custom PHP code that can build captions from any of the detail fields in the library, including custom fields.

GIC relies on WordPress shortcodes — specifically, the [gallery] shortcode — to trigger the execution of the custom PHP you write. That code identifies which detail fields in the Media Library will be part of a caption and can even include HTML to help format the caption’s layout.

When you create a gallery using the Classic Editor, the [gallery] shortcode is inserted behind the scenes. You can see that by clicking the Text tab to reveal the code:

Screenshot: revealing image gallery shortcode in the WordPress Classic Editor.
By default, the Classic Editor generates shortcode for image galleries.

At its simplest, the [gallery] shortcode includes the ID numbers of the images selected for the display.

By default, the block editor immediately generates the HTML for a gallery when placing a group of images on a web page, but you can still choose the shortcode approach:

  • Click the [+] icon within the editor.

This will bring up the available blocks panel.

  • Begin typing “shortcode” in the search field.
  • Click the [/] (shortcode) icon when it appears.
Screenshot: Beginning a shortcode block in the WordPress block editor.
Requesting a shortcode block.

You can then enter the shortcode in the new block.

Screenshot: Editing a shortcode block in the WordPress block editor.
Adding a shortcode in the block editor.

You must edit WordPress code within your theme to use the GIC plugin. You can add your custom PHP code for captions by editing your theme’s functions.php file. As that file can be replaced when a theme is updated, it’s best practice to create a child theme before making changes to key WordPress files. And, just to stay on the safe side of things, a quick backup never hurts.

An alternative approach is to use a plugin like Code Snippets, which allows you to insert PHP into your site’s code without editing functions.php.

Whether you are directly editing the functions.php file or taking advantage of a plugin like Code Snippets, your code will look something like this:

Screenshot: Custom PHP code for the WordPress GIC gallery plugin.
A PHP function that can be triggered by the shortcode for image galleries.

The key customization occurs on lines 17 and 18 above, where Title and Caption content from the Media Library is being inserted within some basic HTML markup to change the appearance of the captions.

In the Media Library, potential gallery images will require text in those fields:

With the GIC plugin installed along with the custom PHP code, the image captions in the gallery now look like this:

Screenshot: An image gallery in WordPress with captions enhanced by the GIC plugin.
Extended captions generated by the GIC plugin and custom PHP code.

How To Add Image Captions to Featured Images

A featured image will, by default, have no caption in most WordPress themes.

Screenshot: Image with caption in Media Library displaying without caption as featured image.
Featured image on a page (background) and in the Media Library (foreground).

For example, the image above is shown in the Media Library with a caption, but it appears without a caption when used as a featured image.

If you want a caption there, the FSM Custom Featured Image Caption plugin can help.

After the plugin is installed, its settings allow you to specify the stylesheet class you want to assign to your captions, or whether you will add custom CSS.

Screenshot: Settings dialog for the FSM Custom Featured Image Caption plugin.
The plugin’s settings dialog.

By default, the Custom Featured Image Caption plugin will display the caption stored with the image in the Media Library, but not within the editor.

Screenshot: A featured image displayed with a caption.
Featured image displayed with the caption stored in the Media Library.

The Custom Featured Image Caption plugin also modifies the Featured Image window within both the block editor and the Classic Editor so that it can accept an alternate caption, overriding any caption stored in the Media Library.

Screenshot: Additional controls added by the FSM Custom Featured Image Caption plugin.
Featured image controls added by the plugin, including an alternate caption.

You can hide the caption and the featured image itself using the checkbox options at the bottom of the panel.

Summary

WordPress offers plenty of flexibility when it comes to adding and editing captions for individual images and images within galleries. And if the built-in options aren’t enough, you can use third-party plugins to extend its core functionality.

And here’s a tip: If your web projects are image-intensive, make sure you check out our guide on how to optimize images for web and performance.


Get all your applications, databases and WordPress sites online and under one roof. Our feature-packed, high-performance cloud platform includes:

  • Easy setup and management in the MyKinsta dashboard
  • 24/7 expert support
  • The best Google Cloud Platform hardware and network, powered by Kubernetes for maximum scalability
  • An enterprise-level Cloudflare integration for speed and security
  • Global audience reach with up to 35 data centers and 275 PoPs worldwide

Get started with a free trial of our Application Hosting or Database Hosting. Explore our plans or talk to sales to find your best fit.

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

Contact
San Vito Al Tagliamento 33078
Pordenone Italy
Item added to cart.
0 items - 0.00
Open chat
Scan the code
Hello 👋
Can we help you?