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 Facebook, Pinterest, 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 the 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 |
---|---|---|---|
High (default) | 3 hours | 6 hours | 12 hours |
Medium | 6 hours | 12 hours | 24 hours |
Low | 12 hours | 24 hours | 48 hours |
To put it in layman’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.
Step 2
Click on the “Configuration” submenu.
Step 3
Scroll down to the “Share Counts” section. Select the refresh rate you want. Note: The default is High.
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 WPCode 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(
array(
'modified' => 86400, //1 day in seconds
'rate' => 3600 //1 hour in seconds
),
array(
'modified' => 604800, //7 days in seconds
'rate' => 7200 //2 hours in seconds
)
)
);
}
add_filter('novashare_filter_refresh_rates', 'novashare_custom_refresh_rates');
Recommended settings for high-frequency publishers
If you’re publishing a lot of content, you might need to do some further tweaking. Below are a couple of examples of filters for sites that average 10+ posts per day.
Refresh new content every 24 hours
function novashare_custom_refresh_rates($rates) {
return array(
'max' => 5184000, //60 days in seconds
'sets' => array(
array(
'modified' => 604800, //7 days in seconds
'rate' => 86400 //24 hours in seconds
),
array(
'modified' => 2419200, //28 days in seconds
'rate' => 2592000 //30 days in seconds
)
)
);
}
add_filter('novashare_filter_refresh_rates', 'novashare_custom_refresh_rates');
Refresh new content every 12 hours
function novashare_custom_refresh_rates($rates) {
return array(
'max' => 5184000, //60 days in seconds
'sets' => array(
array(
'modified' => 604800, //7 days in seconds
'rate' => 43200 //12 hours in seconds
),
array(
'modified' => 2419200, //28 days in seconds
'rate' => 2592000 //30 days in seconds
)
)
);
}
add_filter('novashare_filter_refresh_rates', 'novashare_custom_refresh_rates');