X

Delay RSS feed

Adding this to your functions.php file will delay your posts to RSS feed. This is a good way to fix mistakes before they are published to your feed.



Code Snippet:


function publish_later_on_feed($where) {
global $wpdb;

if ( is_feed() ) {
$now = gmdate('Y-m-d H:i:s');

// value for wait; + device
$wait = '5'; // integer
$device = 'MINUTE'; //MINUTE, HOUR, DAY, WEEK, MONTH, YEAR
$where .= " AND TIMESTAMPDIFF($device, $wpdb->posts.post_date_gmt, '$now') > $wait ";
}
return $where;
}

add_filter('posts_where', 'publish_later_on_feed');

Comments  Leave a Reply

  1. Can I use this to delay the posting of the topic feed from bbpress?
    Thanks!

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!