I can’t tell you how many times I have written an article, hit publish, then realized that I made some mistakes. It doesn’t matter how much I proofread a post, it happens all the time. With that, our readers get these articles delivered to them through my feed. Wouldn’t it be nice if I could delay the feed a bit, just in case I have to make a change? Well, you can… and this is how.
The code below will delay your feed for 30 minutes. You can change the time it takes by editing the integer and designating the time in minutes, hours, days, etc.
1. edit your theme’s functions.php file
2. paste the following code between the <?php and the ?>
//-------------------------------------------------------------------------- // Start Delay Feed // -------------------------------------------------------------------------- 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 = '30'; // 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'); // -------------------------------------------------------------------------- // End Delay Feed // --------------------------------------------------------------------------
Note: These functions are not of my own creation, simply things I have found along the way. If you are the author of this function, please let me know so I can properly credit you with your work!