apply_filters ( 'jetpack_top_posts_days', int 2, array $args )

Filter the number of days used to calculate Top Posts for the Top Posts widget.<p>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.</p>

Source file: modules/widgets/top-posts.php

View in GitHub

Parameters

2

(int) 2 Number of days. Default is 2.

$args

(array) The widget arguments.


Changelog

Since: Jetpack 3.9.3


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' );

Have a question?

Comments are closed for this article, but we're still here to help! Visit the support forum and we'll be happy to answer any questions.

View support forum