apply_filters ( 'jetpack_relatedposts_filter_post_type', array $args[’post_type’], string $post_id )

Filter the Post Types where we search Related Posts.

Source file: modules/related-posts/jetpack-related-posts.php

View in GitHub



(array) Array of Post Types.


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


Since: Jetpack 2.8.0


You can for example use the following snippet to include pages in the Related Posts search, which would then display pages in the results that show up on each post:

function jetpackme_add_pages_to_related( $post_type, $post_id ) {
    if ( is_array( $post_type ) ) {
        $search_types = $post_type;
    } else {
        $search_types = array( $post_type );
    // Add pages
    $search_types[] = 'page';
    return $search_types;
add_filter( 'jetpack_relatedposts_filter_post_type', 'jetpackme_add_pages_to_related', 10, 2 );

Have a note to contribute?

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s