XML Sitemap & Google News icon
SEO

XML Sitemap & Google News hooks reference

  • By Rolf Allard van Hagen
  • v5.7.7
  • Updated

XML Sitemap & Google News 5.7.7 has 37 actions and 48 filters, read directly from its source code on Nov 17, 2026. The list updates automatically when a new version is released.

How to use these hooks

Actions let you run your own code at a specific moment. Filters let you change a value before the plugin uses it. Put your code in a child theme's functions.php or a code-snippets plugin, never in the plugin's own files, because updates overwrite them.

functions.phpyour child theme
// Run your own code when XML Sitemap & Google News fires an action
add_action( 'xmlsf_sitemap_loaded', function( $arg1, $request ) {
	// Your code runs here.
}, 10, 2 );

// Change a value XML Sitemap & Google News is about to use
add_filter( 'xmlsf_author_has_published_posts', function( $post_types ) {
	// Change $post_types here.
	return $post_types;
}, 10, 1 );

Parts of a name in {braces} are filled in at runtime (for example a post type or field ID). Choose Example on any hook for a ready-to-edit snippet.

All hooks

  • inc/admin/class-sitemap-fields.php line 47 · used in 5 places
    /**
     * Filters the has_published_posts query argument in the author archive. Must
     * return a boolean or an array of one or multiple post types. Allows to add or
     * change post type when theme author archive page shows custom post types.
     */
    apply_filters( 'xmlsf_author_has_published_posts', $post_types );
  • inc/class-sitemaps-provider-external.php line 105 · used in 2 places
    /**
     * Filters the sitemap entry for the sitemap index.
     */
    apply_filters( 'wp_sitemaps_index_entry', $sitemap_entry, $this->object_type, '', $page );
  • inc/class-sitemap-core.php line 257 · used in 2 places
    /**
     * IT'S A SITEMAP
     */
    do_action( 'xmlsf_sitemap_loaded', 'core', $request['sitemap'] );
  • inc/class-sitemaps-provider-custom.php line 97
    /**
     * Filters the sitemap entry for an individual post.
     */
    apply_filters( 'wp_sitemaps_urls_entry', $sitemap_entry, $url );
  • inc/class-sitemap.php line 264
    /**
     * Filter blogpages
     */
    apply_filters( 'xmlsf_blogpages', $blogpage );
  • inc/class-sitemap-core.php line 268
    /**
     * Developers: add your actions that should run when a sitemap request is with:
     */
    apply_filters( 'xmlsf_core_request', $request );
  • inc/class-sitemap.php line 239
    /**
     * Filter frontpages
     */
    apply_filters( 'xmlsf_frontpages', $frontpage );
  • inc/class-sitemap-news.php line 230
    /**
     * Developers
     */
    apply_filters( 'xmlsf_news_request', $request );
  • inc/class-sitemap-news.php line 197
    /**
     * IT'S A NEWS SITEMAP
     */
    do_action( 'xmlsf_news_sitemap_loaded' );
  • inc/class-sitemap-core.php line 355
    /**
     * Pre-filter the return value of get_lastpostmodified() before the query is
     * run.
     */
    apply_filters( 'xmlsf_pre_get_lastpostmodified', false, $subtype, $page );
  • inc/class-sitemap.php line 458
    /**
     * Pre-filter the return value of get_taxonomy_modified() before the query is
     * run.
     */
    apply_filters( 'xmlsf_pre_get_taxonomy_modified', false, $taxonomy, $page );
  • xmlsf_request

    filter
    inc/class-sitemap-plugin.php line 305
    /**
     * Filters the request.
     */
    apply_filters( 'xmlsf_request', $request );
  • views/feed-sitemap-posttype.php line 42
    /**
     * Developers
     */
    apply_filters( 'xmlsf_root_data', $home_pages );
  • inc/admin/class-sitemap-fields.php line 225 · used in 18 places
    apply_filters( 'xmlsf_advanced_enabled', false );
  • inc/admin/class-sitemap-news-fields.php line 49 · used in 10 places
    apply_filters( 'xmlsf_news_advanced_enabled', false );
  • views/feed-sitemap-author.php line 14 · used in 6 places
    do_action( 'xmlsf_generator' );
  • views/feed-sitemap-author.php line 52 · used in 5 places
    do_action( 'xmlsf_tags_after', 'author', $user );
  • xmlsf_url

    action
    views/feed-sitemap-author.php line 43 · used in 5 places
    do_action( 'xmlsf_url', 'author', $user );
  • views/feed-sitemap-author.php line 60 · used in 5 places
    do_action( 'xmlsf_url_after', 'author', $user, $data );
  • xmlsf_urlset

    action
    views/feed-sitemap-author.php line 15 · used in 5 places
    do_action( 'xmlsf_urlset', 'home' );
  • inc/compat/class-wpml.php line 38 · used in 4 places
    do_action( 'wpml_switch_language', $code );
  • views/feed-sitemap-author.php line 31 · used in 4 places
    apply_filters( 'xmlsf_entry_url', get_author_posts_url( $user->ID ), 'author', $user );
  • inc/class-bwt-connect.php line 43 · used in 3 places
    do_action( 'sitemap_notifier_refresh_access_token_error', $error, 'error' );
  • inc/class-sitemaps-provider-custom.php line 47 · used in 3 places
    apply_filters( 'xmlsf_custom_urls', (array) \get_option( 'xmlsf_urls', array() ) );
  • inc/functions.php line 113 · used in 3 places
    apply_filters( 'xmlsf_sitemaps_enabled', $return, $which );
  • inc/admin/class-sitemap-settings.php line 145 · used in 2 places
    do_action( 'sitemap_notifier_manual_submission', $message, $status );
  • inc/compat/class-wpml.php line 36 · used in 2 places
    apply_filters( 'wpml_active_languages', null );
  • inc/compat/class-wpml.php line 37 · used in 2 places
    apply_filters( 'wpml_default_language', null );
  • views/admin/page-sitemap-news.php line 62 · used in 2 places
    do_action( 'xmlsf_admin_sidebar', 'news' );
  • inc/class-sitemaps-provider-external.php line 41 · used in 2 places
    apply_filters( 'xmlsf_custom_sitemaps', (array) \get_option( 'xmlsf_custom_sitemaps', array() ) );
  • inc/class-sitemap-plugin.php line 683 · used in 2 places
    apply_filters( 'xmlsf_index_archive_data', array(), $post_type, $archive );
  • inc/class-sitemap-news.php line 238 · used in 2 places
    apply_filters( 'xmlsf_news_post_types', $post_types );
  • inc/class-sitemap-core.php line 736 · used in 2 places
    do_action( 'xmlsf_nginx_helper_purge_urls', $urls );
  • inc/class-sitemap-core.php line 190 · used in 2 places
    do_action( 'xmlsf_register_sitemap_provider' );
  • inc/class-sitemap-core.php line 201 · used in 2 places
    do_action( 'xmlsf_register_sitemap_provider_after' );
  • inc/class-sitemap-news.php line 27 · used in 2 places
    apply_filters( 'xmlsf_sitemap_news_slug', 'sitemap-news' );
  • inc/class-sitemap-core.php line 20 · used in 2 places
    apply_filters( 'xmlsf_sitemap_slug', 'wp-sitemap' );
  • inc/class-sitemap-core.php line 180 · used in 2 places
    apply_filters( 'xmlsf_sitemap_url', $sitemap_url, $sitemap );
  • views/feed-sitemap.php line 45 · used in 2 places
    apply_filters( 'xmlsf_taxonomies_query_args', array( 'taxonomy' => $the_taxonomy, 'number' => $limit, 'hide_empty' => true, 'hierarchical' => false, 'update_term_meta_cache' => false, ), $the_taxonomy );
  • inc/functions-pluggable.php line 160
    apply_filters( 'get_firstpostdate', _get_post_time( $timezone, 'date', $post_type, 'first' ), $timezone );
  • inc/functions-pluggable.php line 194
    apply_filters( 'get_lastmodified', $modified, $timezone );
  • inc/admin/class-sitemap-news-settings.php line 98
    do_action( 'sitemap_notifier_manual_submission_news', $message, $status );
  • inc/admin/class-sitemap-settings.php line 324
    do_action( 'xmlsf_add_settings', $active_tab );
  • inc/admin/class-sitemap-settings.php line 173
    apply_filters( 'xmlsf_bwt_manual_submit_timeframe', 360 );
  • inc/admin/class-sitemap-settings.php line 77
    do_action( 'xmlsf_clear_settings' );
  • inc/functions.php line 204
    apply_filters( 'xmlsf_defaults', $return, $key, $defaults );
  • inc/class-xmlsitemapfeed.php line 321
    apply_filters( 'xmlsf_disabled_post_types', $this->disabled_post_types );
  • inc/class-xmlsitemapfeed.php line 312
    apply_filters( 'xmlsf_disabled_taxonomies', $this->disabled_taxonomies );
  • views/feed-sitemap-posttype.php line 84
    apply_filters( 'xmlsf_excluded', get_post_meta( $post->ID, '_xmlsf_exclude', true ), $post->ID );
  • views/feed-sitemap-author.php line 18
    apply_filters( 'xmlsf_get_author_args', array( 'orderby' => 'post_count', 'order' => 'DESC', 'number' => '1000', 'fields' => array( 'ID', 'user_login', 'spam', 'deleted' ), 'has_published_posts' => true, ) );
  • inc/admin/class-sitemap-news-settings.php line 57
    apply_filters( 'xmlsf_gsc_manual_submit_news_timeframe', MINUTE_IN_SECONDS );
  • inc/admin/class-sitemap-settings.php line 104
    apply_filters( 'xmlsf_gsc_manual_submit_timeframe', 360 );
  • inc/class-sitemap-plugin.php line 626
    do_action( 'xmlsf_image_tags_inner', 'post_type' );
  • inc/class-sitemap-plugin.php line 152
    apply_filters( 'xmlsf_index_url_args', \wp_parse_args( $args, array( 'type' => false, 'm' => false, 'w' => false, ) ) );
  • xmlsf_install

    action
    upgrade.php line 52
    do_action( 'xmlsf_install' );
  • inc/admin/class-sitemap-news-settings.php line 178
    do_action( 'xmlsf_news_add_settings', $active_tab );
  • views/feed-sitemap-news.php line 29
    apply_filters( 'xmlsf_news_entry_url', get_permalink(), $post );
  • views/feed-sitemap-news.php line 37
    apply_filters( 'xmlsf_news_excluded', get_post_meta( $post->ID, '_xmlsf_news_exclude', true ), $post->ID );
  • inc/admin/class-sitemap-news-settings.php line 460
    do_action( 'xmlsf_news_help_tabs', $screen, $active_tab );
  • inc/class-sitemap-news.php line 297
    apply_filters( 'xmlsf_news_hours_old', 48 );
  • views/feed-sitemap-news.php line 55
    apply_filters( 'xmlsf_news_language', get_bloginfo( 'language' ), $post->ID, $post->post_type );
  • views/admin/page-sitemap-news.php line 23
    do_action( 'xmlsf_news_nav_tabs', $active_tab );
  • views/admin/field-news-post-type.php line 33
    apply_filters( 'xmlsf_news_post_type_field_type', 1 === count( $news_post_type ) ? 'radio' : 'checkbox' );
  • views/feed-sitemap-news.php line 53
    apply_filters( 'xmlsf_news_publication_name', ( defined( 'XMLSF_GOOGLE_NEWS_NAME' ) && XMLSF_GOOGLE_NEWS_NAME ? XMLSF_GOOGLE_NEWS_NAME : get_bloginfo( 'name' ) ), $post->ID, $post->post_type );
  • inc/admin/class-sitemap-news-settings.php line 168
    do_action( 'xmlsf_news_sclear_ettings' );
  • views/admin/page-sitemap-news.php line 35
    do_action( 'xmlsf_news_settings_after', $active_tab );
  • views/admin/page-sitemap-news.php line 29
    do_action( 'xmlsf_news_settings_before', $active_tab );
  • views/feed-sitemap-news.php line 64
    do_action( 'xmlsf_news_tags_after', $post );
  • views/feed-sitemap-news.php line 60
    do_action( 'xmlsf_news_tags_inner', $post );
  • views/feed-sitemap-news.php line 58
    apply_filters( 'xmlsf_news_title', get_the_title() );
  • views/feed-sitemap-news.php line 43
    do_action( 'xmlsf_news_url', $post );
  • views/feed-sitemap-news.php line 69
    do_action( 'xmlsf_news_url_after', $post );
  • inc/class-sitemap.php line 97
    apply_filters( 'xmlsf_post_types', $this->post_types );
  • views/admin/field-sitemap-post-type-settings.php line 30
    do_action( 'xmlsf_posttype_archive_field_options', $obj, $archive );
  • views/admin/page-sitemap.php line 48
    do_action( 'xmlsf_settings_after', $active_tab );
  • views/admin/page-sitemap.php line 42
    do_action( 'xmlsf_settings_before', $active_tab );
  • inc/admin/class-sitemap-settings.php line 732
    do_action( 'xmlsf_sitemap_help_tabs', $screen, $active_tab );
  • views/feed-sitemap.php line 17
    do_action( 'xmlsf_sitemap_index' );
  • views/feed-sitemap.php line 94
    do_action( 'xmlsf_sitemap_index_after' );
  • views/admin/page-sitemap.php line 36
    do_action( 'xmlsf_sitemap_nav_tabs', $active_tab );
  • inc/class-sitemap-news.php line 157
    apply_filters( 'xmlsf_sitemap_news_url', \home_url( $basename ) );
  • views/feed-sitemap-author.php line 39
    apply_filters( 'xmlsf_skip_user', false, $user );
  • inc/functions.php line 89
    apply_filters( 'xmlsf_stylesheet_url', $url );
  • xmlsf_upgrade

    action
    upgrade.php line 227
    do_action( 'xmlsf_upgrade', $db_version );

Generated from XML Sitemap & Google News's GPL-licensed source code. Hooks inside bundled third-party libraries are not listed.

Can't find the right hook?

We can build the customisation for you. Describe what you need: