How to delay your website’s RSS feed

Really Simple Syndication (RSS) is an open-source web feed that allows users and applications to access websites updates in a standardized format that’s easy for computers to read. It’s from the “early” internet (launched in 1999!) and although Google suggests I might want to search “is RSS is dead 2020,” it’s still a widely used system for bundling and sharing everything from news articles to podcast episodes. So, not dead.[1]The History of RSS is interesting, and so is the history of Creative Commons.
Usually, posts are added to the RSS feed right when they’re published. If you edit the post, the version in your site’s RSS feed can take time to update, depending on the server, other plugins, website caching, and who knows what else.
If you use WordPress, you can ususally find your site’s RSS by typing in the URL and adding /feed at the end.

Delaying an RSS feed
There are a number of reasons someone might want to delay the RSS feed of their site. Here at pink sheep, we wanted to look into this because we help manage many websites. There are often multiple folks involved who catch errors or want to make changes after publishing. Sometimes WordPress’ draft preview or other version control system don’t cut it, and you just need to publish and let everyone take a look.
Another motivation, apparently, is related to content-scrapers. Though delayed RSS doesn’t stop people from publishing your content without attribution or linking back, the delay could possibly help to prove that the content was yours originally, or to keep your page higher in search results.
The plugin method
It’s very straightforward. There are two plugins I could find that accomplish this, and the one linked below is what I chose. I picked it because of it’s more recent update, though neither had reviews which gave me a moment of pause. But, it does work!
Once you install and activate the plugin, you can set up a delay in seconds, minutes, or hours.
I chose ten minutes and ran a test. And it worked.[2]First I used CTRL + F to check whether the RSS feed already contained a keyword from the post I was publishing (Surprisingly, before today there was no mention of picnics on the blog). After hitting … Continue reading
The code snippet method
This technique can look intimidating to newer WordPress users.[3]We sometimes use a plugin for code snippets, called… well, Code Snippets. It cuts out a lot of the more technical side of adding code to your site. That said, there are resources available for … Continue reading
I got this code from WP Beginner.
function publish_later_on_feed($where) {
global $wpdb;
if ( is_feed() ) {
$now = gmdate('Y-m-d H:i:s');
// value for wait; + device
$wait = '10'; // integer
$device = 'MINUTE'; //MINUTE, HOUR, DAY, WEEK, MONTH, YEAR
$where = " AND TIMESTAMPDIFF($device, $wpdb->posts.post_date_gmt, '$now') > $wait ";
}
return $where;
}
add_filter('posts_where', 'publish_later_on_feed');
The ‘wait =‘ and ‘device =‘ in roughly the middle of the code snippet is where you enter the delay you want. Right now the code is set to 10 minutes. At first, it didn’t work. This was my first code snippet I’ve personally run, so I wasn’t sure if I needed to fill in more info. “if ( is_feed() ) { ” seemed to me like it was asking for some blanks to be filled in. But it turns out, that was part of what I was doing wrong! The code above is ready to be used, with only the 10 and minute intended to be edited, if need be.
I’m not 100% sure if this works. It could be interacting with site caching or other things.
References
↑1 | The History of RSS is interesting, and so is the history of Creative Commons. |
---|---|
↑2 | First I used CTRL + F to check whether the RSS feed already contained a keyword from the post I was publishing (Surprisingly, before today there was no mention of picnics on the blog). After hitting ‘publish’, I checked at the one minute, eight minute, and about eleven minute marks. Lo and behold, the keyword yielded results at the last check. |
↑3 | We sometimes use a plugin for code snippets, called… well, Code Snippets. It cuts out a lot of the more technical side of adding code to your site. That said, there are resources available for learning how to edit your theme’s code more directly. Once you install and activate that plugin, if you haven’t already, navigate to ‘Snippets’ on the left hand WordPress menu. Add the code below as a snippet, and make sure to include a description/note and, this is important: activate the snippet. I did not do this the first time and spent too long trying to figure out what the error was in the code itself. |