Developers

Developer Reference

Published

Super Speedy Sitemaps is built to be extended. Sitemap types are pluggable modules, and almost every decision about what goes into a sitemap can be changed with a filter. Put the code below in a small custom plugin or a must-use plugin (wp-content/mu-plugins/), not in the plugin’s own files, so it survives updates.

Every example on this page was run against a live test site and its output checked.

Excluding items

Exclude posts by ID

add_filter( 'sssm_gxs_excluded_posts', function ( $excluded, $post_type ) {
	if ( 'post' === $post_type ) {
		$excluded[] = 123;
	}
	return $excluded;
}, 10, 2 );

$post_type is the post type of the sitemap being built (post, page, product and so on). Return an array of post IDs. Items excluded on the settings screen are merged with yours.

Exclude terms by ID or slug

add_filter( 'sssm_gxs_excluded_term_slugs', function ( $slugs, $taxonomy ) {
	if ( 'category' === $taxonomy ) {
		$slugs[] = 'internal';
	}
	return $slugs;
}, 10, 2 );

sssm_gxs_excluded_terms works the same way with term IDs: function ( $term_ids, $taxonomy ).

Add your own SQL condition

sssm_gxs_post_where appends a condition to the query that selects posts for a post-based sitemap. Start it with AND, and use the p alias for the posts table:

add_filter( 'sssm_gxs_post_where', function ( $where, $post_type ) {
	if ( 'post' === $post_type ) {
		$where .= " AND p.comment_status = 'open'";
	}
	return $where;
}, 10, 2 );

The condition is placed inside a prepared query, so do not use % characters (for example LIKE '%term%'). Escape any value you build into it with esc_sql().

External pages

sssm_gxs_external_pages adds URLs to page_external.xml. Turn on External (non-WordPress) pages on the XML Sitemaps tab so the sitemap is listed in the index.

add_filter( 'sssm_gxs_external_pages', function ( $pages ) {
	$pages[] = array(
		'location' => home_url( '/app/' ),
		'lastmod'  => '2026-10-01',
		'freq'     => 'weekly',
		'priority' => '0.7',
	);
	return $pages;
} );
KeyRequiredValue
locationYesAn absolute URL on your own site
lastmodNoAny date or date-time PHP can parse, in your site’s timezone
freqNoalways, hourly, daily, weekly, monthly, yearly, never, or auto to calculate it from lastmod
priorityNo0.1 to 1.0

Adding a whole sitemap to the index

When another plugin or system already writes its own sitemap file, list it in the index with sssm_gxs_external_sitemaps instead of copying its URLs:

add_filter( 'sssm_gxs_external_sitemaps', function ( $sitemaps ) {
	$sitemaps[] = array(
		'location' => home_url( '/shop-sitemap.xml' ),
		'lastmod'  => '2026-10-01',
	);
	return $sitemaps;
} );

This is how Super Speedy Filters lists its own sitemap parts in the index.

Custom sitemap modules

A module is a PHP class that builds one sitemap. To publish a sitemap the plugin knows nothing about, write a module, put it in a custom module directory, and register it.

1. Point the plugin at your module directory

Either set Advanced Options > Sitemap modules > Custom module directory to a full server path, or use the filter:

add_filter( 'sssm_gxs_module_dir', function () {
	return WP_CONTENT_DIR . '/sitemap-modules';
} );

2. Register the module

add_action( 'sssm_gxs_modules_built', function () {
	global $sssm_gxs;
	$sssm_gxs->add_module( 'custom', 'landing' );
} );

A module named custom with sub-module landing is served at /custom_landing.xml and listed in the sitemap index automatically. Use the two-part form: the plugin’s URL rules route any <module>_<sub-module>.xml address, while a single-word name needs its own rewrite rule through sssm_gxs_rewrite_rules.

3. Write the module

Save this as wp-content/sitemap-modules/custom_landing.php. The file name is <module>_<sub-module>.php, and the class name is SSSM_GXS_MODULE_ followed by the same name in capitals:

<?php
class SSSM_GXS_MODULE_CUSTOM_LANDING extends SSSM_GXS_MODULE
{
	protected function generate_data()
	{
		foreach ( array( '/offers/', '/stores/' ) as $path ) {
			$data             = $this->init_data();
			$data['location'] = home_url( $path );
			$data['freq']     = 'weekly';
			$data['priority'] = 0.8;
			$this->data[]     = $data;
		}

		// false = no more batches to fetch
		return false;
	}
}

generate_data() is called repeatedly while it returns true, so a module can fetch its rows in batches. Return false once everything has been added, or the same rows are added again on every call.

Common mistake

Returning true from a module that adds all its rows in one pass fills the sitemap with repeated copies of those rows until the item limit is reached.

Overriding a built-in module

A file in the custom module directory with the same name as a built-in module (for example page.php) is used instead of the built-in one. The Sitemap Log records “name.xml will be served using module file file in the custom module directory” whenever that happens.

Indexability for other SEO plugins

The SEO Framework and Super Speedy Filters decide which taxonomies and terms are indexable. Any other plugin can publish the same kind of decision.

Taxonomy-level decision

add_filter( 'sssm_gxs_taxonomy_indexability', function ( $decision, $taxonomy ) {
	if ( 'product_brand' === $taxonomy ) {
		return array(
			'allowed'  => false,
			'provider' => 'My SEO Plugin',
			'reason'   => 'Brand archives are set to noindex in My SEO Plugin.',
			'edit_url' => admin_url( 'admin.php?page=my-seo' ),
		);
	}
	return $decision;
}, 10, 2 );

A taxonomy that is not allowed gets no sitemap. Its checkbox on the XML Sitemaps tab is greyed out, and the help icon shows your provider, reason and edit_url.

Term-level decision

add_filter( 'sssm_gxs_term_indexability', function ( $allowed, $term_id, $taxonomy ) {
	if ( 'category' === $taxonomy && get_term_meta( $term_id, 'my_noindex', true ) ) {
		return false;
	}
	return $allowed;
}, 10, 3 );

Raw term list

sssm_gxs_terms receives the array of term rows fetched for a taxonomy sitemap, function ( $terms, $taxonomy ), before any XML is built. Return the array with any rows removed.

Change frequency, priority and lastmod

FilterArgumentsChanges
sssm_gxs_freq$freq, $itemThe <changefreq> of one URL
sssm_gxs_priority_score$score, $item, $freqThe <priority> of one URL
sssm_gxs_sitemap_lastmod$lastmod, $raw_lastmod, $item, $indexThe <lastmod> of one entry in the sitemap index

Routing and output

FilterUse
sssm_gxs_rewrite_rulesAdd rewrite rules, for example for a single-word custom module. Flush permalinks after changing them
sssm_gxs_xsltReplace the XSLT stylesheet URL
sssm_gxs_cache_dirReturn a full path to store cached sitemap files somewhere other than wp-content/uploads/super-speedy-sitemaps
sssm_gxs_news_name, sssm_gxs_news_languages, sssm_gxs_news_keyword_mapGoogle News publication name, language list and keyword mapping

AI agents

Super Speedy Sitemaps registers WordPress abilities in the super-speedy-sitemaps namespace (get-config, update-config, flush-cache) for MCP clients. See Controlling Super Speedy Sitemaps with MCP.

Further reading

The settings these filters extend.
How the built-in indexability decisions work.
Limits and batching that custom modules run under.

Written for Super Speedy Sitemaps 1.11.17.

Comments

▲
▼
1/1