Filter the number of days used to calculate Top Posts for the Top Posts widget. We do not recommend accessing more than 10 days of results at one. When more than 10 days of results are accessed at once, results should be cached via the WordPress transients API. Querying for -1 days will give results for an infinite number of days.
Parameters
- $args
array The widget arguments.
- 2
int Number of days. Default is 2.
Changelog
- Introduced in Jetpack 3.9.3
How to use this hook
Notes
You can use thejetpack_top_posts_days filter to change the number of days used to calculate Top Posts. In the example below, we’ll change that timeframe to 30 days:
function jetpackme_top_posts_timeframe() {
return '30';
}
add_filter( 'jetpack_top_posts_days', 'jetpackme_top_posts_timeframe' );