Skip to content

Commit de8b6e1

Browse files
committed
Do not add newly noindexed URLs to the ping list.
1 parent e1f8ce2 commit de8b6e1

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

inc/namespace.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -310,15 +310,12 @@ function ping_indexnow( $post ) {
310310
$current_url = get_permalink( $post );
311311

312312
/*
313-
* Only add the current URL if it is publicly viewable.
313+
* Only add the current URL if it is publicly viewable and indexed.
314314
*
315-
* This prevents unnecessary pings for private or draft posts in
316-
* which the current URL will 404. If the URL has been previously
317-
* pinged, it will be included in the list of URLs to ping as IndexNow
318-
* allows for new 404s to be pinged to encourage search engines
319-
* to remove the URL from their index.
315+
* This prevents unnecessary pings for new URLs that are either not
316+
* viewable (ie, will 404) or noindexed by an SEO plugin.
320317
*/
321-
if ( is_post_publicly_viewable( $post ) && ! in_array( $current_url, $url_list, true ) ) {
318+
if ( is_post_publicly_viewable( $post ) && ! SEOCompat\is_noindex( $post ) && ! in_array( $current_url, $url_list, true ) ) {
322319
$url_list[] = get_permalink( $post );
323320
}
324321

0 commit comments

Comments
 (0)