MOin on Jul 13, 2010 | Tips & Tutorials

How to Delay RSS Feed Update When You Publish a New Post

Delicious

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.

Stumble it Digg it Vote on Reddit Add to delicious
Tweet it Share on facebook Add to Technorati Float it

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

Leave a Reply


You can submit your free wordpress theme in WP skinner user submitted themes gallery to get Downloads and popularity. Its Free! ​ ​ Submit your Theme

View All >>

About | Contact | Submit your Theme
© 2010 WP Skinner | Powered by WordPress Top ^