Skip to content

Sitemaps

padams edited this page Oct 14, 2026 · 4 revisions

Sitemaps

PhotoPress adds the pages of images and image taxonomy terms to the site's XML sitemap, whether WordPress, Jetpack or Yoast SEO builds it. The Sitemap card on PhotoPress › Settings › Pages & Search shows which sitemap is in use.

Requirements

  • WordPress 6.6 or later. WordPress's own sitemap needs no other plugin.
  • Optional: Jetpack with its Sitemaps module, or Yoast SEO with its XML sitemaps.
  • Search engines must be allowed to index the site (Settings › Reading). WordPress builds no sitemap otherwise.

Settings

PhotoPress's sitemap entries have no switches of their own. They follow the two page switches on the same tab (see Attachment and Taxonomy Pages):

Control Effect on the sitemap Default
Attachment pages On: images' own pages are listed. Off: they are not, since their addresses lead to the files. WordPress's own setting
Image taxonomy pages On: term archive pages are listed. Off: they are not. On

The Sitemap card
The Sitemap card, on a site that discourages search engines.

The card shows one of these statuses:

Status When
WordPress's sitemap is in use WordPress's sitemap is enabled. View the sitemap opens WordPress's sitemap index.
Jetpack's sitemap is in use, last built … ago WordPress's sitemap is off and Jetpack built its sitemap more recently than Yoast SEO, within the last 30 days.
Yoast SEO's sitemap is in use, last built … ago WordPress's sitemap is off and Yoast SEO built its sitemap more recently than Jetpack, within the last 30 days.
Another plugin has turned off WordPress's sitemap WordPress's sitemap is off and neither Jetpack nor Yoast SEO has built one in the last 30 days.
Search engines are discouraged from indexing this site Discourage search engines from indexing this site is checked in Settings › Reading.

For Jetpack and Yoast SEO, View the sitemap opens /sitemap.xml.

How it works

PhotoPress lists the following, through whichever sitemap is in use:

  • Image pages, while attachment pages are on. Only public images: unattached images and images attached to a published post.
  • Term archive pages, while image taxonomy pages are on. Only public image taxonomies, and only terms with images.
  • The images on a term's archive page: the newest 10, as image entries of that page (Yoast SEO only).
  • Unattached images while attachment pages are off: listed with the archive of their first term (Jetpack only).

WordPress's sitemap (wp-sitemap.xml)

Listed When
Image pages, as an attachment sitemap Attachment pages on. WordPress leaves attachments out of its sitemap by default. PhotoPress adds them back, limited to public images.
Term archive pages Image taxonomy pages on. WordPress lists them itself. With the switch off, the taxonomies are not viewable and WordPress leaves them out.

WordPress's sitemap has no image entries. It lists pages, not image files.

Jetpack

Listed When
Term archive pages, among Jetpack's pages Image taxonomy pages on. Jetpack lists no taxonomy terms itself.
Each image in Jetpack's image sitemap, with its own page Attachment pages on. Jetpack would otherwise list an attached image with its post's page.
An unattached image, with its first term's archive page Attachment pages off. Without a term archive the image is left out, since its own page address would be the file.
An attached image, with its post's page Attachment pages off. Jetpack's default.

Jetpack skips images attached to an unpublished post.

Yoast SEO

Listed When
Term archive pages Yoast SEO lists them itself. PhotoPress removes image taxonomies from Yoast SEO's sitemap while image taxonomy pages are off.
Up to 10 image files with each term archive page Image taxonomy pages on.
Media pages of attached images Yoast SEO lists them itself while its media pages setting has them, for images attached to a published post. PhotoPress removes them while attachment pages are off.
Pages of unattached images, in photopress-image-sitemap.xml While Yoast SEO lists media pages and attachment pages are on. Yoast SEO's own media sitemap leaves unattached images out. Each entry includes the image file.

The PhotoPress sitemap is split into photopress-image-sitemap.xml, photopress-image-sitemap2.xml and so on, with Yoast SEO's entries-per-sitemap limit. It appears in Yoast SEO's sitemap index.

WordPress integration

Hook Type Code Purpose
wp_sitemaps_post_types filter CoreSitemap.php#L22 Adds the attachment post type while attachment pages are on (postTypes()).
wp_sitemaps_posts_query_args filter CoreSitemap.php#L23 For attachment: post_status inherit, post_mime_type image, and the photopress_public_images query var (queryArgs(), ImageSitemap::imagesQuery()).

ImageSitemap decides what is listed for all three sitemaps. Each adapter calls it from its own hooks, and those hooks run only while that plugin builds its sitemap.

Core functions relied on: wp_sitemaps_get_server() and WP_Sitemaps::sitemaps_enabled(), get_sitemap_url(), is_taxonomy_viewable(), get_term_link(), wp_get_object_terms().

Data stored:

Option Content
photopress_sitemap_seen When Jetpack's and Yoast SEO's sitemaps were last built with PhotoPress's hooks: [ 'jetpack' => timestamp, 'yoast' => timestamp ]. Written at most once a day per sitemap. Not autoloaded (seen()).

The card's status comes from ImageSitemap::inUse(). The page receives it as window.photopressSitemap (search.php#L121).

Third-party integrations

PhotoPress uses only documented public hooks and interfaces of Jetpack and Yoast SEO. Without either plugin, its hooks never run.

Jetpack (Sitemaps module)

Hook Type Code Purpose
jetpack_page_sitemap_other_urls filter JetpackSitemap.php#L28 Appends term archive addresses. Also records that Jetpack's sitemap was built (otherUrls()).
jetpack_sitemap_image_skip_post filter JetpackSitemap.php#L29 While attachment pages are off, skips an unattached image without a term archive (skipImage()).
jetpack_sitemap_image_sitemap_item filter JetpackSitemap.php#L30 Sets url.loc to the image's own page (attachment pages on), or to an unattached image's first term archive (off) (imageItem()).

Yoast SEO

Hook / API Type Code Purpose
wpseo_sitemap_exclude_post_type filter YoastSitemap.php#L27 Excludes attachment while attachment pages are off (excludePostType()).
wpseo_sitemap_exclude_taxonomy filter YoastSitemap.php#L28 Excludes an image taxonomy that is not viewable (excludeTaxonomy()).
wpseo_sitemap_urlimages_term filter YoastSitemap.php#L29 Adds a term archive's newest image files (termImages()).
wpseo_sitemaps_providers filter YoastSitemap.php#L30 Adds YoastImagesSitemap, when the WPSEO_Sitemap_Provider interface exists (providers()).
WPSEO_Sitemap_Provider interface YoastImagesSitemap.php#L14 The photopress-image sitemap of unattached images: get_index_links() also records that Yoast SEO's sitemap was built. get_sitemap_links() gives each image's page, modified date and file.
WPSEO_Post_Type::is_post_type_accessible(), is_post_type_indexable() functions YoastImagesSitemap.php#L69 With wpseo_sitemap_exclude_post_type, Yoast SEO's own test of whether it lists media pages (listed()).

The Yoast SEO hooks are added in the search module's constructor (search.php#L74), since Yoast SEO collects its sitemap providers at after_setup_theme, before init. YoastImagesSitemap is loaded only when Yoast SEO asks for its providers.

Limits, quirks and known issues

  • Term images are capped. Each term archive lists its 10 newest images (TERM_IMAGES). They are drawn from the newest 2,000 public images of the taxonomy (TERM_SCAN). A term whose images are all older has no images listed.
  • A term is listed when WordPress's count of its images is above zero. That count includes images attached to unpublished posts, so a term whose images are all non-public is still listed.
  • Jetpack builds its sitemap in the background and stores it. PhotoPress's changes appear in it after Jetpack's next build.
  • The card shows Jetpack or Yoast SEO only after it has built a sitemap with PhotoPress active. The status lapses 30 days after the last build.
  • A sitemap plugin other than WordPress, Jetpack or Yoast SEO receives nothing from PhotoPress.

Related

Clone this wiki locally