# Customize Jetpack Related Posts

> Changes the heading, number of posts and thumbnail visibility of Jetpack's Related Posts, and limits suggestions to posts from the last two years.

- Type: PHP
- Runs: Run everywhere
- Category: [Plugin Integrations](https://wpide.com/library/category/integrations/)
- Tags: jetpack, related-posts, content
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/jetpack-related-posts-options/

## Code

```php
$wpide_headline = 'You might also enjoy'; // Heading text.
$wpide_count    = 3;                       // Posts to show (max 6).
$wpide_years    = 2;                       // Only suggest posts from the last N years; 0 = no limit.

add_filter( 'jetpack_relatedposts_filter_headline', function () use ( $wpide_headline ) {
    return '<h3 class="jp-relatedposts-headline"><em>' . esc_html( $wpide_headline ) . '</em></h3>';
} );

add_filter( 'jetpack_relatedposts_filter_options', function ( $options ) use ( $wpide_count ) {
    $options['size'] = max( 1, min( 6, (int) $wpide_count ) );

    return $options;
} );

add_filter( 'jetpack_relatedposts_filter_date_range', function ( $range ) use ( $wpide_years ) {
    if ( ! $wpide_years ) {
        return $range;
    }

    return array(
        'from' => strtotime( '-' . (int) $wpide_years . ' years' ),
        'to'   => time(),
    );
} );
```

## Notes

Edit the values at the top. Jetpack can show at most 6 related posts.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Customize Jetpack Related Posts" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
