Action and Filter hooks

A quick overview of all available action and filter hooks in XML Sitemap & Google News.

Action hooks

Hook nameContextDescription
xmlsf_pingAdmin, XML Sitemap, Google NewsFires when a search engine has been pinged. Carries four arguments: search engine (google|yandex|bing), sitemap name, full ping URL, ping response code.
xmlsf_urlsetXML SitemapFired inside each sitemap’s <urlset> tag. Can be used to echo additional XML namespaces. Passes parameter home|post_type|taxonomy|custom to allow identification of the current sitemap.
xmlsf_urlXML SitemapFired inside the XML Sitemap loop at the start of each sitemap <url> tag. Can be used to echo additional XML namespaces. Passes parameter home|post_type|taxonomy|custom to allow identification of the current sitemap.
xmlsf_image_tags_innerXML SitemapFired inside the XML Sitemap loop just before each closing </image:image> is generated. Can be used to echo custom <image:image> tags or trigger another action in the background.
xmlsf_tags_afterXML SitemapFired inside the XML Sitemap loop at the end of the tags, just before each closing </url> is generated. Can be used to echo custom tags or trigger another action in the background. Passes parameter home|post_type|taxonomy|custom to allow identification of the current sitemap.
xmlsf_url_afterXML SitemapFired inside the XML Sitemap loop after each <url> node. Can be used to append alternative URL or trigger another action in the background. Passes parameter home|post_type|taxonomy|custom to allow identification of the current sitemap.
xmlsf_news_urlsetGoogle NewsFired inside the Google News Sitemap urlset tag. Can be used to echo additional XML namespaces.
xmlsf_news_tags_innerGoogle NewsFired inside the Google News Sitemap loop at the end of the news tags, just before each closing </news:news> is generated. Can be used to echo custom news:news tags or trigger another action in the background.
xmlsf_news_tags_afterGoogle NewsFired inside the Google News Sitemap loop at the end of the news tags, just before each closing </url> is generated. Can be used to echo custom news tags or trigger another action in the background.
xmlsf_news_url_afterGoogle NewsFired inside the Google News Sitemap loop after each news url node. Can be used to append alternative url or trigger another action in the background.
xmlsf_news_settings_beforeAdmin, Google NewsFired before the Google News Sitemap settings form.
xmlsf_news_settings_afterAdmin, Google NewsFired after the Google News Sitemap settings form.

Filter hooks

Hook nameContextDescription
xmlsf_defaultsAdmin, XML Sitemap, Google NewsFilters the default array values for different option groups.
xmlsf_requestXML SitemapFilters request when an XML sitemap request is found, can be used for plugin compatibility.
xmlsf_news_requestGoogle NewsFilters request when a news sitemap request is found can be used for plugin compatibility.
xmlsf_allowed_domainXML SitemapFilters the response when checking the URL against allowed domains. Passes variable $url; must return true or false.
xmlsf_index_url_argsXML Sitemap IndexFilters the index URL arguments array.
xmlsf_excludedXML SitemapFilters the response when checking the post for exclusion flags in XML Sitemap context. Passes the post exclusion flag and $post_id; must return true or false.
xmlsf_news_excludedGoogle NewsFilters the response when checking the post for exclusion flags in Google News sitemap context. Passes variable $post_id; must exclusion flag, return true or false.
xmlsf_news_keywordsGoogle NewsFilters the news keywords array.
xmlsf_news_stock_tickersGoogle NewsFilters the news stock tickers array.
xmlsf_disabled_taxonomiesXML SitemapFilters the taxonomies that should be unavailable for sitemaps. Passes an array of taxonomies to exclude; must return an array.
the_title_xmlsitemapXML SitemapFilters the Image title and caption tags.
xmlsf_news_publication_nameGoogle NewsFilters the Google News publication name.
xmlsf_news_titleGoogle NewsFilters the Google News post title.
xmlsf_root_dataXML SitemapFilters the root data URLs (with priority and lastmod) array.
xmlsf_custom_urlsXML SitemapFilters the custom URLs array.
xmlsf_custom_sitemapsXML Sitemap IndexFilters the custom sitemaps array.
xmlsf_news_languageGoogle NewsFilters the post language tag used in the news sitemap. Passes variable $post_id; must return a 2 or 3 letter ISO 639 language code with the exception of zh-cn and zh-tw.
xmlsf_post_typesXML Sitemap IndexFilters the post types array for the XML sitemaps index.
xmlsf_post_priorityXML SitemapFilters a post priority value. Passes variables $priority and $post->ID. Must return a float value between 0.1 and 1.0
xmlsf_term_priorityXML SitemapFilters a taxonomy term priority value. Passes variables $priority and $term->slug. Must return a float value between 0.1 and 1.0
xmlsf_author_post_typesXML SitemapFilters the post type that is used to get author archive lastmod date. Passes variable array('post'). Must return an array of one or more (public) post type slugs.
xmlsf_news_post_typesAdmin, Google NewsFilters the post types array for the Google News sitemap settings page.