filter

jetpack_top_posts_days

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

How to use this hook

See “How to use actions and filters to customize Jetpack”.

Notes

You can use the jetpack_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' );