# Move Jetpack Related Posts Into a Shortcode

> Removes Jetpack's Related Posts from the bottom of posts and lets you place them anywhere with a [wpide_related] shortcode or in your theme.

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

## Code

```php
add_action( 'wp', function () {
    if ( ! class_exists( 'Jetpack_RelatedPosts' ) || ! method_exists( 'Jetpack_RelatedPosts', 'init' ) ) {
        return;
    }

    $jprp = Jetpack_RelatedPosts::init();
    remove_filter( 'the_content', array( $jprp, 'filter_add_target_to_dom' ), 40 );
}, 20 );

add_shortcode( 'wpide_related', function () {
    if ( ! class_exists( 'Jetpack_RelatedPosts' ) || ! is_singular() ) {
        return '';
    }

    return do_shortcode( '[jetpack-related-posts]' );
} );
```

## Notes

Jetpack also offers its own Related Posts block; this is for classic themes and page builders.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Move Jetpack Related Posts Into a Shortcode" 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/
