Use the code NOVASHARE for 10% off!

How to change share counts refresh rate

If you are using share counts in Novashare, you can adjust the rate at which your social share counts are updated based on the modified date. Why do we have this option? One reason: performance.

Whenever a post or page runs an update to refresh your social share counts, it does an API call to get the latest count from Twitter, Facebook, etc. This will result in a little bit of latency because it has to grab data from an external site.

The great news is that you can change how often this update happens using a staggered approach. This is great for performance and marketing purposes, as your newer content should be updating counts more frequently while it’s being shared at its peak volume.

It’s important to note that many of you probably won’t notice a delay. Also, if your WordPress site is set up correctly, then it should be serving from cache a majority of this time. The update/API call only happens on uncached requests.

This feature is simply for those who are laser-focused on performance and to optimize the uncached calls better. Remember, if you don’t care about share counts, no API calls are made at all if they aren’t enabled.

Modified time< 7 days< 28 days> 28 days
High3 hours6 hours12 hours
Medium6 hours12 hours24 hours
Low12 hours24 hours48 hours

To put it in laymen’s terms, “Low” would be the best for performance, while “High” would be the best if you care about keeping your social share counts updated more often.

You can change the refresh rate in the settings of the plugin or with a filter if you want to pass in your own refresh rates.

Change share counts refresh rate

Follow the steps below on how to set a total minimum share count in Novashare.

Step 1

Click into the Novashare plugin settings.

Novashare plugin settings

Step 2

Click into the “Configuration” section of the Options tab. Scroll down and under “Share Counts Refresh Rate” select the option you want. Note: The default is High.

Share Counts Refresh Rate
Share Counts Refresh Rate

Step 3

Scroll down and click “Save Changes.”

Use a filter to pass your own refresh rates

You can use our built-in filter to override your Novashare plugin settings with your own share count refresh rates. If you need an easy way to add it, we recommend the free Code Snippets plugin.

Here is an example of using the filter to pass a set of custom refresh rates. In this example, we first pass a maximum refresh rate time (in seconds) that will be used if the post modified date is older than any of the included sets.

We then pass through an array of sets which include a modified date and a rate (both in seconds). The following sets will use a refresh rate of 1 hour for posts less than a day old and a refresh rate of 2 hours for posts less than 7 days old. For any posts older than that, the maximum refresh rate set previously will be used.

function novashare_custom_refresh_rates($rates) {
	return array(
		'max' => 10800, //3 hours in seconds
		'sets' => array(
				'modified' => 86400, //1 day in seconds
				'rate' => 3600 //1 hour in seconds
				'modified' => 604800, //7 days in seconds
				'rate' => 7200 //2 hours in seconds
add_filter('novashare_filter_refresh_rates', 'novashare_custom_refresh_rates');

Was this article helpful?

Related Articles