How to Delay Posts From Appearing in WordPress RSS Feed
Do you want to delay posts from appearing in your site’s RSS feed?
Delaying posts from appearing immediately can save you from sending out unfinished work accidentally, give you time to edit typos you might see, and help you beat content scrapers in SEO.
In this article, we will show you how to delay posts from appearing in WordPress RSS feed.
Why Delay Your RSS Feed in WordPress?
Sometimes you may publish a something on your WordPress blog with a typo that you just didn’t see. The mistake is then distributed to your RSS feed and all of your subscribers. If you have email subscriptions on your WordPress blog, then those subscribers will get it as well.
By adding a delay between your RSS feed and your live site, you get a little window of time to catch an error on a live site and fix it.
RSS feeds are also used by content scraping websites. They use it to monitor your content and copy your posts as soon as they appear live. If you have a new website with little authority, then a lot of times these content scrapers may end up beating you in the search results.
By delaying an article in your RSS feed, you can give search engines enough time to crawl and index your content first.
Having said that, let’s see how to easily delay posts from appearing in WordPress website‘s RSS feed.
How to Delay Posts in Your WordPress RSS Feed
To begin, we recommend using WPCode to delay posts from appearing in your site’s feed. WPCode lets you add custom code to WordPress safely and easily without having to worry about your site breaking.
For advanced users, you can copy/paste the following code into your theme’s functions.php file instead. You’ll need to modify the code to change the time interval. Remember that editing your core WordPress files can be dangerous, which is why we recommend WPCode. You’ll also lose any custom code snippets when you update your theme.
For details, see our article on how to paste code snippets from the web into WordPress.
function wpb_snippet_publish_later_on_feed( $where ) {
global $wpdb;
if ( is_feed() ) {
// Timestamp in WP-format.
$now = gmdate( 'Y-m-d H:i:s' );
// Number of unit to wait
$wait="10"; // integer.
// Choose time unit.
$unit="MINUTE"; // MINUTE, HOUR, DAY, WEEK, MONTH, YEAR.
// Add SQL-sytax to default $where. By default 10 minutes.
$where .= " AND TIMESTAMPDIFF($unit, $wpdb->posts.post_date_gmt, '$now') > $wait ";
}
return $where;
}
add_filter( 'posts_where', 'wpb_snippet_publish_later_on_feed' );
Now we’ll show you how to do this the easy way with WPCode.
First, you will need to install and activate the free WPCode plugin. For details, you can follow our step-by-step guide on how to install a WordPress Plugin.
Upon activation, you can navigate to Code Snippets » Add Snippet. After that, simply search for ‘rss’ or scroll down to the ‘RSS Feeds’ category.
Then, just hover your mouse over ‘Delay Posts in RSS Feeds’ in the results and simply click on ‘Use snippet.’
Next, you will be taken to the ‘Edit Snippet’ screen, where WPCode has pre-configured the snippet settings for you.
By default, your posts will be delayed from appearing in your RSS feed by 10 minutes from the time it’s published.
If that delay is good for you, then all you have to do is click on the switch to change it to ‘Active’ and press the ‘Update’ button.
If you want to alter the length of the delay, you can do so by changing the number on Line 10 and the unit of time on Line 13.
For example, you can delay the post by one hour if you replace $wait="10";
and $unit="MINUTE"
with $wait="1"
and $unit="HOUR"
.
If you need to adjust the delay again, simply repeat those steps, and if you want the posts to go back to hitting the feed immediately, simply toggle the switch back to ‘Inactive’ and press ‘Update.’
Don’t Forget to Check Out the WPCode Snippet Library
WPCode also comes with a huge collection of other code snippets, too. You can see what’s there at Code Snippets » Library in your admin dashboard.
You may be able to replace some single-use plugins on your site by simply activating snippets you find in the library.
For example, you can find snippets that will let you disable automatic updates, allow SVG uploads, set a minimum word count for posts, and much more.
We hope this article helped you learn how to easily delay posts from appearing in WordPress RSS feed. You may also want to see our guide on how to create an email newsletter the right way, or see our expert pick of the best live chat software for small business.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
No Comments