Tell Feed Readers How Often to Check
Sets the update period and time-to-live in your RSS feed, so feed readers check a daily blog once a day instead of every hour.
Opens WPIDE on
Code
// How often you publish: hourly, daily, weekly, monthly or yearly.
$wpide_feed_period = 'daily';
// How many times per period.
$wpide_feed_frequency = 1;
// Minutes a reader may cache the feed.
$wpide_feed_ttl = 1440;
add_filter( 'rss_update_period', function () use ( $wpide_feed_period ) {
return $wpide_feed_period;
} );
add_filter( 'rss_update_frequency', function () use ( $wpide_feed_frequency ) {
return (string) absint( $wpide_feed_frequency );
} );
add_action( 'rss2_head', function () use ( $wpide_feed_ttl ) {
echo '<ttl>' . absint( $wpide_feed_ttl ) . "</ttl>\n";
} );
Notes
Readers treat these values as hints. Match them to how often you actually publish.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.