Shared Counts uses smart caching to minimize API queries since they can slow down the load time for visitors. We refresh recent content more often.
- Posts published in the last 24 hours are updated every 30 minutes
- Posts published in the last 5 days are updated every 6 hours
- Posts older than that are updated every 5 days
You can customize how often posts are refreshed using the shared_counts_update_increments
filter.
The code below will change the refresh rate to:
- Every 15 minutes for posts published in last 2 days
- Every 6 hours for posts published in last 7 days
- Every 3 days for posts older than that
This code snippet goes in a core functionality plugin or Code Snippets.
Filters used:
shared_counts_update_increments