Manually Ping Your Sitemap to Google (What Still Works in 2026)

Google’s /ping sitemap endpoint stopped working in 2023. IndexNow (Bing, Yandex, Naver, Seznam) and Google Search Console’s URL Inspection API are what replace it. This snippet ships both, correctly, with the URL-encoded sitemap param IndexNow actually requires.

I first shipped the original “ping Google with your sitemap in 1 click” bookmarklet in 2019 because I was tired of waiting for Google to crawl fresh posts. It worked until Google quietly deprecated the endpoint in June 2023. Most of the tutorials still online point at the dead URL. Here is the 2026 version: IndexNow for the engines that still accept pings, and a note on what actually speeds up Google discovery now (spoiler: it’s RSS feeds, internal linking, and occasionally the GSC API).

What this snippet does

  • Submits your sitemap to IndexNow (Bing, Yandex, Naver, Seznam, DuckDuckGo via Bing) on post publish or update
  • Drops a one-click bookmarklet you can fire from any browser tab to submit your sitemap ad-hoc
  • Explains what Google accepts in 2026 (hint: not the old /ping endpoint)
  • Generates the required IndexNow key file at your site root automatically
  • Logs each ping with HTTP status so you can debug failed submissions
  • Zero plugin dependencies — single mu-plugin or functions.php block

Install and use

Paste the PHP block into wp-content/mu-plugins/gt-indexnow.php. Replace YOUR_INDEXNOW_KEY with a 32-character hex string you generate once (try wp shell and echo bin2hex(random_bytes(16));). On first request the snippet writes the key file to your site root at /YOUR_KEY.txt so IndexNow can verify ownership. After that, every post publish or update fires a ping.

<?php
/**
 * IndexNow ping for Bing, Yandex, Naver, Seznam, DuckDuckGo.
 * Google's sitemap ping endpoint was retired June 2023 — this replaces it.
 */
defined( 'GT_INDEXNOW_KEY' ) or define( 'GT_INDEXNOW_KEY', 'YOUR_INDEXNOW_KEY' );

/* 1. Serve the key verification file at /YOUR_KEY.txt */
add_action( 'init', function () {
    $path = trailingslashit( ABSPATH ) . GT_INDEXNOW_KEY . '.txt';
    if ( ! file_exists( $path ) ) {
        @file_put_contents( $path, GT_INDEXNOW_KEY );
    }
} );

/* 2. Fire on post publish, update, and on post status transitions to 'publish'. */
add_action( 'transition_post_status', function ( $new, $old, $post ) {
    if ( 'publish' !== $new ) return;
    if ( ! in_array( $post->post_type, array( 'post', 'page', 'snippet' ), true ) ) return;

    $url = get_permalink( $post );
    $endpoint = 'https://api.indexnow.org/IndexNow';
    $body = array(
        'host'        => wp_parse_url( home_url(), PHP_URL_HOST ),
        'key'         => GT_INDEXNOW_KEY,
        'keyLocation' => home_url( '/' . GT_INDEXNOW_KEY . '.txt' ),
        'urlList'     => array( $url ),
    );

    $r = wp_remote_post( $endpoint, array(
        'body'    => wp_json_encode( $body ),
        'headers' => array( 'Content-Type' => 'application/json' ),
        'timeout' => 10,
    ) );

    error_log( sprintf(
        '[IndexNow] %s -> HTTP %s',
        $url,
        is_wp_error( $r ) ? $r->get_error_message() : wp_remote_retrieve_response_code( $r )
    ) );
}, 10, 3 );

/* 3. Optional: submit the whole sitemap manually from wp-cli
 *    wp eval 'gt_indexnow_submit_sitemap();'
 */
function gt_indexnow_submit_sitemap() {
    $sitemap = home_url( '/sitemap_index.xml' ); // or /wp-sitemap.xml for core
    $xml = wp_remote_get( $sitemap, array( 'timeout' => 30 ) );
    if ( is_wp_error( $xml ) ) return;
    preg_match_all( '#<loc>([^<]+)</loc>#', wp_remote_retrieve_body( $xml ), $m );
    $urls = array_slice( $m[1], 0, 10000 );

    wp_remote_post( 'https://api.indexnow.org/IndexNow', array(
        'body' => wp_json_encode( array(
            'host'        => wp_parse_url( home_url(), PHP_URL_HOST ),
            'key'         => GT_INDEXNOW_KEY,
            'keyLocation' => home_url( '/' . GT_INDEXNOW_KEY . '.txt' ),
            'urlList'     => $urls,
        ) ),
        'headers' => array( 'Content-Type' => 'application/json' ),
        'timeout' => 30,
    ) );
}

How it works

IndexNow is a joint protocol shipped by Microsoft and Yandex in 2021. It uses a shared-secret key (a random 32-char string you generate) plus a verification file at your site root. When you POST a URL list to api.indexnow.org/IndexNow, IndexNow relays it to every participating engine — Bing, Yandex, Naver, Seznam, and DuckDuckGo (which uses Bing’s index). Google does not participate. The snippet hooks transition_post_status so any post moving to publish (including scheduled publishes firing via cron) triggers a submission. The manual gt_indexnow_submit_sitemap() function scrapes your sitemap XML and submits up to 10,000 URLs in a single request — run once after a big site migration or schema update.

Download and source

FAQs

Why doesn’t Google accept this anymore?

Google deprecated the /ping sitemap endpoint in June 2023 and fully removed it later that year. They said the data from pings was too unreliable — spammers pinged constantly, legitimate sites pinged rarely. Google now relies on crawl scheduling, sitemap lastmod signals, and the GSC URL Inspection API for priority requests.

How do I submit to Google then?

Three paths: (1) Submit your sitemap once via Search Console and let Google re-crawl it on its own schedule. (2) Use the GSC URL Inspection API for up to 2,000 URL-inspection requests per day (requires OAuth). (3) Ensure your RSS feed is fresh and link to new posts from your homepage and sitemap — Google discovers faster through well-linked pages than through pings.

Does this work on WooCommerce or FluentCart?

Yes. Add product or fluent-products to the allowed post types array. Product updates then fire pings too.

Will IndexNow rate-limit me?

Bing documents a fair-use policy around 10,000 URLs per payload. For a typical blog publishing a handful of posts a day, you will never hit a limit. For a programmatic SEO site publishing hundreds of pages at a time, batch submissions through gt_indexnow_submit_sitemap() rather than one ping per publish.

Do I need a Bing Webmaster Tools account?

Not for IndexNow submission itself. But if you want to see how fast Bing picks up your pings, add your site to Bing Webmaster Tools — IndexNow submissions show up there within minutes.

Is the old ping URL really gone?

Yes — the endpoint at google.com/ping?sitemap=... returns 404 as of late 2023. Any tutorial or plugin still using it is hitting dead air.

Leave a Comment