Hold new posts out of your RSS feed for 10 minutes after publishing, so you have time to fix mistakes before feed readers and scrapers grab them.
add_filter( 'posts_where', function ( string $where, WP_Query $query ): string {
if ( $query->is_main_query() && $query->is_feed() ) {
global $wpdb;
$cutoff = gmdate( 'Y-m-d H:i:s', time() - 10 * MINUTE_IN_SECONDS );
$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date_gmt <= %s", $cutoff );
}
return $where;
}, 10, 2 );
Always add PHP to a staging site first, or have FTP or file manager access ready, so you can undo it if something goes wrong.
The moment you publish, feed readers, email newsletter tools and content scrapers can pick up your post. If you spot a typo a minute later, it’s already gone out. This snippet gives you a 10-minute grace period.
The posts_where filter adds a condition to the feed’s database query: only include posts published more than 10 minutes ago, compared in UTC. Your site and archive pages show new posts straight away; only feeds wait.
10 to suit how quickly you usually catch mistakes.Publish a post and open /feed/ straight away. The post shouldn’t be there yet; after 10 minutes it should.