File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed
Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments