Source file: modules/related-posts/jetpack-related-posts.php
View in GitHubParameters
- $args[’exclude_post_ids’]
-
(array) Array of Post IDs.
- $post_id
-
(string) Post ID of the post for which we are retrieving Related Posts.
Changelog
Since: Jetpack 2.9.0
Notes
In the following example, 1037
and 1038
are the IDs of the posts we want to exclude:
function jetpackme_exclude_related_post( $exclude_post_ids, $post_id ) { // $post_id is the post we are currently getting related posts for $exclude_post_ids[] = 1037; // Exclude post_id 1037 $exclude_post_ids[] = 1038; // Also exclude post_id 1038 return $exclude_post_ids; } add_filter( 'jetpack_relatedposts_filter_exclude_post_ids', 'jetpackme_exclude_related_post', 20, 2 );