Top Ad unit 728 × 90

Control When Your Posts are Available via RSS


There are times when you publish a post and suddenly find an error. You can go back in the admin panel and change it, but it is already published in the feeds. With this hack, you can put a delay of as many minutes as you like, so you can double check the post live.
Simply open your functions.php and add the following code in there:
01function publish_later_on_feed($where) {
02global $wpdb;
03
04if ( is_feed() ) {
05// timestamp in WP-format
06$now gmdate('Y-m-d H:i:s');
07
08// value for wait; device
09$wait '10'// integer
10
11// http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_timestampdiff
12$device 'MINUTE'//MINUTE, HOUR, DAY, WEEK, MONTH, YEAR
13
14// add SQL-sytax to default $where
15$where .= " AND TIMESTAMPDIFF($device, $wpdb->posts.post_date_gmt, '$now') > $wait ";
16}
17return $where;
18}
19
20add_filter('posts_where''publish_later_on_feed');
Change the time from 10 minutes to whatever you like.
If terms like feedsyndication, and RSS make your head spin, stop right now and read an Introduction to Syndication. That will give you a good overview of feeds and syndication. We have an article on WordPress Feeds to help you understand the basics, if you need them, but from here on, this article assumes that you know the basics of what feeds are and how they are used.
Customized feeds give your readers more information about you and your blog: you can include the names of additional collaborators on your blog posts, or a link to your Friend-of-a-Friend file. Contrariwise, it can also help you restrict the information available for syndication, by removing extraneous data or providing a machine-readable version of your copyright statement.
Control When Your Posts are Available via RSS Reviewed by Unknown on 9:52 PM Rating: 5

No comments:

All Rights Reserved by Boca Raton Real Estate © 2014 - 2015
Powered By Blogger, Designed by Sweetheme

Contact Form

Name

Email *

Message *

Powered by Blogger.