Delay New Posts in RSS Feeds
Waits 15 minutes before new posts appear in your feeds, giving you time to fix typos before feed readers and newsletters pick them up.
Opens WPIDE on
Code
add_filter( 'posts_where', function ( $where, $query ) {
global $wpdb;
if ( ! $query->is_main_query() || ! $query->is_feed() ) {
return $where;
}
$minutes = 15;
$cutoff = gmdate( 'Y-m-d H:i:s', time() - $minutes * MINUTE_IN_SECONDS );
return $where . $wpdb->prepare( " AND {$wpdb->posts}.post_date_gmt <= %s", $cutoff );
}, 10, 2 );
Notes
Change $minutes to adjust the delay.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.