filter

jetpack_relatedposts_filter_date_range

Filter the date range used to search Related Posts.

Parameters

$args['date_range']
array

Array of a month interval where we search Related Posts.

$post_id
string

Post ID of the post for which we are retrieving Related Posts.

Changelog

How to use this hook

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

Notes

In the example below, we use the filter to only return posts from the past 6 months:
function jetpackme_related_posts_past_halfyear_only( $date_range ) {
    $date_range = array(
        'from' => strtotime( '-6 months' ),
        'to' => time(),
    );
    return $date_range;
}
add_filter( 'jetpack_relatedposts_filter_date_range', 'jetpackme_related_posts_past_halfyear_only' );