How to add images to a WordPress XML sitemap
To add images to a WordPress sitemap with Hydrogen SEO, open Hydrogen SEO → Sitemap, switch on Include Images in Sitemap in the Sitemap Status card and click Save Changes. Each post's entry then lists its featured image and the images in its content as image:image tags. WordPress's built-in sitemap has no image support.
Image entries sit inside the normal page entry. There is no separate file to submit, and the images are tied to the page that shows them, which is how Google asks for them.
Step by step
1. Check whether you already have image entries
Open your sitemap index, then the post sitemap (sitemap-post.xml with Hydrogen SEO). View the raw XML and search for image:loc. If the core sitemap at /wp-sitemap.xml is what loads, you will find none: core lists page URLs and last-modified dates only.
2. Switch on image entries
- Go to Hydrogen SEO → Sitemap.
- In Sitemap Status, make sure Enable XML Sitemap is on.
- Switch on Include Images in Sitemap.
- Click Save Changes in the top bar. This screen does not save by itself, and saving refreshes the sitemap cache.
3. Read an entry
Reload the post sitemap. An entry with images looks like this:
<url>
<loc>https://example.com/pour-over-guide/</loc>
<lastmod>2026-11-03T09:12:44+00:00</lastmod>
<image:image>
<image:loc>https://example.com/wp-content/uploads/2026/11/pour-over.jpg</image:loc>
</image:image>
</url>
The urlset element at the top of the file declares the image namespace, xmlns:image="http://www.google.com/schemas/sitemap-image/1.1". Without that declaration the image tags would be invalid, so if you ever build a sitemap by hand, include it.
4. Know which images are included
For each post the plugin lists the featured image first, at full size, then every image found in the post content, skipping duplicates. Images that only appear through the theme, such as a logo, a sidebar banner or a background set in CSS, are not part of the post and are not listed. Images added by a shortcode or page builder that stores its data outside the post content may be missed for the same reason.
5. Add or remove images in code
Developers can adjust the list per post with a filter that receives the image array and the post ID:
add_filter( 'hydrogen_seo_sitemap_post_images', function ( $images, $post_id ) {
$gallery = get_post_meta( $post_id, 'gallery_image_url', true );
if ( $gallery ) {
$images[] = array( 'loc' => esc_url_raw( $gallery ) );
}
return $images;
}, 10, 2 );
Each item needs a loc with the image URL. Use this for images held in custom fields, or to drop decorative images you do not want listed.
6. Validate and let Google re-read it
Paste the sitemap into the XML sitemap validator to catch namespace and URL problems. You do not need to resubmit in Search Console when the sitemap URL has not changed. Google fetches the file again by itself. If you never submitted it, follow submit a sitemap to Google.
7. Make the images worth indexing
A sitemap helps Google find an image. It does not describe it. Give each meaningful image alt text in the Media Library, use file names made of words, and keep images on pages whose text is about the same subject. If many images have no alt text, see bulk add alt text.
When image entries make a difference
Google normally finds images by crawling the pages that embed them, so on a site with ordinary <img> tags the gain is modest. Entries help most when images are loaded by JavaScript, such as lazy-loaded galleries and sliders that do not put a real src in the HTML, and when images are served from a CDN hostname. Google's documentation allows image URLs on a different domain from the page.
Things that keep images out of Google
- robots.txt blocking the uploads folder or the CDN host. Google must be able to fetch the image file.
- A
noimageindexdirective. It is off by default in Hydrogen SEO's Snippets & Previews card. If someone switched it on, images on those pages are not indexed whatever the sitemap says. - The page itself is noindex. Noindexed posts are left out of the sitemap, images included.
- Hotlink protection that blocks Googlebot. Allow search engine crawlers in the rule.
Common questions
Does the default WordPress sitemap include images?
No. The core sitemap lists URLs and modification dates only. Image entries need a plugin or custom code.
Do I need a separate image sitemap?
No. Image tags can live inside your normal sitemap entries, attached to the page that displays them, which is the approach Hydrogen SEO uses.
Will image sitemap entries improve rankings?
They help discovery, not ranking. An image Google already finds by crawling the page gains little. Hidden or script-loaded images gain the most.