Created
May 28, 2014 11:22
-
-
Save rickrduncan/f730d55d6a2e4575dda6 to your computer and use it in GitHub Desktop.
Small script to place in child theme functions.php file to delay the publishing of a new RSS feed file.
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 | |
//* Do NOT include the opening php tag | |
//* Delay the adding of new content to the WordPress RSS feed | |
function b3m_delay_publish_rss_feed($where) { | |
global $wpdb; | |
if ( is_feed() ) { | |
// timestamp in WP-format | |
$now = gmdate( 'Y-m-d H:i:s' ); | |
//* value for wait; + device | |
$wait = '15'; //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', 'b3m_delay_publish_rss_feed'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment