Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added check to prevent duplicate search engine ping jobs #4521

Merged
merged 1 commit into from May 10, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion inc/sitemaps/class-sitemaps-admin.php
Expand Up @@ -116,11 +116,13 @@ public function status_transition( $new_status, $old_status, $post ) {

// Allow the pinging to happen slightly after the hit sitemap index so the sitemap is fully regenerated when the ping happens.
$excluded_posts = explode( ',', $options['excluded-posts'] );

if ( ! in_array( $post->ID, $excluded_posts ) ) {

if ( defined( 'YOAST_SEO_PING_IMMEDIATELY' ) && YOAST_SEO_PING_IMMEDIATELY ) {
WPSEO_Sitemaps::ping_search_engines();
}
else {
elseif ( ! wp_next_scheduled( 'wpseo_ping_search_engines' ) ) {
wp_schedule_single_event( ( time() + 300 ), 'wpseo_ping_search_engines' );
}
}
Expand Down