Advertisement
wissamdandan

Delay Wordpress RSS Feed

May 22nd, 2013
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. /**
  2. * puplish the content in the feed later
  3. * $where ist default-var in WordPress (wp-includes/query.php)
  4. * This function an a SQL-syntax
  5. */
  6. function publish_later_on_feed($where) {
  7. global $wpdb;
  8. if ( is_feed() ) {
  9. // timestamp in WP-format
  10. $now = gmdate('Y-m-d H:i:s');
  11. // value for wait; + device
  12. $wait = '5'; // integer
  13. // http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_timestampdiff
  14. $device = 'MINUTE'; //MINUTE, HOUR, DAY, WEEK, MONTH, YEAR
  15. // add SQL-sytax to default $where
  16. $where .= " AND TIMESTAMPDIFF($device, $wpdb->posts.post_date_gmt, '$now') > $wait ";
  17. }
  18. return $where;
  19. }
  20. add_filter('posts_where', 'publish_later_on_feed');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement