Skip to content

Instantly share code, notes, and snippets.

@jeherve
Forked from richardmtl/jp_restrict_rp.php
Last active February 10, 2018 10:50
Show Gist options
  • Save jeherve/493ff3c9eea3f200e08933934301fa39 to your computer and use it in GitHub Desktop.
Save jeherve/493ff3c9eea3f200e08933934301fa39 to your computer and use it in GitHub Desktop.
Restrict Jetpack's Related Posts to a specific time-frame
function jetpackme_related_posts_date_restricted( $date_range, $post_id ) {
// We can change this based on $post_id too but let's just filter everything
$date_range = array(
'from' => strtotime( '1 January 2013' ),
'to' => time(),
);
return $date_range;
}
add_filter( 'jetpack_relatedposts_filter_date_range', 'jetpackme_related_posts_date_restricted', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment