Change how often share counts refresh

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:

Published by Bill Erickson

Bill Erickson is a freelance WordPress developer and a contributor to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.