-
-
Save jpmarchand/bb61016b066211995cba to your computer and use it in GitHub Desktop.
Delay posts from appearing immediately in WordPress RSS feed. Source: http://wpengineer.com/320/publish-the-feed-later/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//* Delay posts from appearing immediately in WordPress RSS feed | |
add_filter('posts_where', 'customprefix_delay_rss_feed'); | |
function customprefix_delay_rss_feed($where) { | |
global $wpdb; | |
if ( is_feed() ) { | |
$now = gmdate('Y-m-d H:i:s'); // Timestamp in WordPress format | |
$wait = '10'; // Integer | |
$device = 'MINUTE'; // MINUTE, HOUR, DAY, WEEK, MONTH, YEAR | |
$where.= " AND TIMESTAMPDIFF($device, $wpdb->posts.post_date_gmt, '$now') > $wait "; // Add SQL syntax to default $where | |
} | |
return $where; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment