Contextual Related Posts v3.0.0 introduced CRP_Query which works as a wrapper for WP_Query. This brings all the power and flexibility of WP_Query to Contextual Related Posts. If you’re not familiar with WP_Query, I recommend reading docs.

Standard Loop

get_crp_posts()

get_crp_posts() works as a wrapper to CRP_Query and can be used to retrieve an array of the related posts. It also accepts the same $args as CRP_Query above.

Parameters

In addition to the WP_Query parameters, CRP_Query also takes these additional parameters.

$args

(array) (Optional) Arguments to retrieve posts. See crp_get_registered_settings()for all available arguments.

  • ‘include_cat_ids’
    (array|string) An array or comma-separated string of category IDs. This should be the term_taxonomy_id.
  • ‘include_post_ids’
    (array|string) An array or comma-separated string of post IDs.
  • ‘offset’
    (int) number of post to displace or pass over. Warning: Setting the offset parameter overrides/ignores the paged parameter and breaks pagination. The 'offset' parameter is ignored when 'posts_per_page'=>-1 (show all posts) is used.
  • ‘postid’
    (int) Get related posts for a specific post ID.
  • ‘strict_limit’
    (bool) If this is set to false, then it will fetch 3x posts.