• I have new status posts on a WordPress blog that get published on Saturday nights with the title “UNCHECKED”.

    There are a few dozen “client” WP sites that would like to display the current status from the blog infrequently from Saturday night until Friday at noon when the status may change to “DOWN”, “UP” or remain “UNCHECKED”.

    Is there a way to configure wp_feed_cache_transient_lifetime to force the websites to display the current status using the following intervals?

    Friday 8pm-9am: 3hr intervals for 157 hours
    Friday 9am-noon: 1hr intervals
    Friday noon-3pm: 15 minute intervals
    Friday 3pm-8pm: 5 minute intervals

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    You use the ‘wp_feed_cache_transient_lifetime’ filter by adding a filter callback with add_filter(). Your callback returns the value (in seconds) to use when setting the cache lifetime. Your callback could use a switch/case structure to determine which interval to return. The PHP date() function can be used to get the current hour of day or even the day number.

    I don’t know if this would force sites to use the current status though. The filter fires when a WP_Feed_Cache_Transient object is created. I don’t know when that actually happens. It’d be worth a try to hook the filter as a simple proof of concept to see if changing the intervals (regardless of time of day) has the desired effect. If that checks out, then you can work on the switch/case logic.

Viewing 1 replies (of 1 total)
  • The topic ‘Custom RSS feed cache timing’ is closed to new replies.