How to Delay RSS Feed Update When You Publish a New Post
Normally when you publish a new post on your blog, Your RSS readers get blog updates instantly. If you tend to make errors while writing posts such as title mistakes and spelling mistakes then probably you’ll face load of embarrassment when your readers point out your spell mistake or typo.
This little WordPress hack can save you from such bad times. Following piece of code will delay RSS feed update for 5 minutes when you update your blog. You can easily increase RSS update delay time.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | function publish_later_on_feed($where) { global $wpdb; if ( is_feed() ) { // timestamp in WP-format $now = gmdate('Y-m-d H:i:s'); // value for wait; + device $wait = '5'; // integer // http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_timestampdiff $device = 'MINUTE'; //MINUTE, HOUR, DAY, WEEK, MONTH, YEAR // add SQL-sytax to default $where $where .= " AND TIMESTAMPDIFF($device, $wpdb->posts.post_date_gmt, '$now') > $wait "; } return $where; } add_filter('posts_where', 'publish_later_on_feed'); |
Increase or Decrease update delay:
In the above code find $wait = ’5′; // integer and change 5 to anything you like. If you want to increase more than an hour find $device = ‘MINUTE’; and change it to MINUTE, HOUR, DAY, WEEK, MONTH or YEAR.




