Delay the ping to Google when publishing new Posts or Pages

When a Post/Page is published, WP helpfully informs Google about it. But it has happened few times that someone accidentally publishes a product Page before the launch, they of course unpublish it in the same minute, but it's already beamed into Google (if I'm not mistaken). Is there a way add a few minute delay to that?

Related: I know it's possible to add a delay to RSS feed publishing. I've also installed the plugin "Confirm Publishing Actions" which remedies the accidents pretty well.

Topic pingbacks Wordpress

Category Web


The pingback functions run via the hoook do_pings. The core use the follow default:

add_action( 'do_pings', 'do_all_pings', 10, 1 );

This hook is on default a cron job, running in the scheduling as single event of the core.

I think you should remove this hook via remove_action and add a custom logic to fire this function later, after your publishing. You can do that via the scheduling functions of the core, like the core functions but with your enhancements to run later as the publish date of the post.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.