Control When Your Posts are Available Via RSS


There are times when after making a post live we realize it needs something to be changed or modified correctly. You go back to admin panel and change it but the post is already published in your RSS feeds. But with this simple trick you can delay the time after which the post becomes live on RSS feeds also so that you get sufficient time to double check your post.

Procedure:

Note: Do take backup of your theme before you try this.

01. In your WordPress Admin panel go to Appearance => Editor.

02. Then choose functions.php file from right hand side and add below code:

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 = ‘5‘; // 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’);

03. In above code change 5 to the time delay you want in your RSS feed publication. In above example it is set to 5 Minutes.

That concludes this simple and useful tutorial. Hope you like it.

  • Halaman

  • October 2010
    M T W T F S S
    « Sep   Nov »
     123
    45678910
    11121314151617
    18192021222324
    25262728293031
  • RSS 20 Newest Free

  • RSS Brothersoft

  • RSS New Software

  • AntiVirus

  • Status Anda

    IP
  • Pengunjung

    free counters
  • Blog Stats

    • 328,581 hits
  • Add to Google Reader or Homepage Subscribe in NewsGator Online Add to netvibes Subscribe in Bloglines Add to fwicki Add to Webwag Powered by FeedBurner

  • Friends Link

  • RSS Kompas

    • An error has occurred; the feed is probably down. Try again later.
  • RSS Lowongan Kerja Terbaru 2013

    • An error has occurred; the feed is probably down. Try again later.
  • RSS Loker.id

  • Info Tentang AQ

  • Meta

  • %d bloggers like this: