How to publish wordpress feeds later

How to publish wordpress feeds later

When you publish your post,the feed an published to the whole world.That’s very annoying thing. publish wordpress feeds later, That is always good from SEO.

How to publish wordpress feeds later

How to publish wordpress feeds later
How to publish wordpress feeds later

Some times you need to change the content or change the url, that time you got the errors

The following example publishs the post 10 minutes later in your feed:


/**
 * puplish the content in the feed later
 * $where ist default-var in WordPress (wp-includes/query.php)
 * // Apply filters on where and join prior to paging so that any
 * This function an a SQL-syntax
 */
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 = '10'; // 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');

You need to open the your wordpress themes functions.php file and put above code in that file. Using this function your feed will publish after 10 minute of your wordpress post publishing.

Published by

Purab

I am Purab from India, Software development is my profession and teaching is my passion. Programmers blog dedicated to the JAVA, Python, PHP, DevOps and Opensource Frameworks. Purab's Github Repo Youtube Chanel Video Tutorials Connect to on LinkedIn

Leave a Reply

Your email address will not be published.