Skip to main content

The signals from the social networks are cached in the standard for new posts (not older than 30 days) up to 15 minutes. This time can be adjusted using the following filter:

add_filter('at_social_cache_new_posts', 'at_change_social_cache_new_posts', 10, 1);
function at_change_social_cache_new_posts($interval) {
    return 2 * HOUR_IN_SECONDS;
}

In this case, the cache is valid for 2 hours.

The return value determines the duration. The actual value is measured in seconds. If the return is “10”, the validity of the cached is exactly 10 seconds. There are several predefined constants (e.g., HOUR_IN_SECONDS) of WordPress which can be used:

MINUTE_IN_SECONDS = 60 (seconds)
HOUR_IN_SECONDS = 60 * MINUTE_IN_SECONDS
DAY_IN_SECONDS = 24 * HOUR_IN_SECONDS
WEEK_IN_SECONDS = 7 * DAY_IN_SECONDS
YEAR_IN_SECONDS = 365 * DAY_IN_SECONDS

Further information is available here.


Was this article helpful?

1 Star2 Stars3 Stars4 Stars5 Stars
(No Ratings Yet)

Keine Kommentare vorhanden


You have a question or an opinion about this post? Share it with us!

Your email address will not be published. Required fields are marked *

*
*