Source file: modules/related-posts/jetpack-related-posts.php
View in GitHubParameters
- $args[’post_type’]
-
(array) Array of Post Types.
- $post_id
-
(string) Post ID of the post for which we are retrieving Related Posts.
Changelog
Since: Jetpack 2.8.0
Notes
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 );