Related Posts for WordPress uses multiple types of content to determine what is related. This includes titles, content, categories, tags. I wrote a post on what makes a post related on the Related Posts for WordPress website that goes into depth on how these different types of content are used.
Post Meta Fields
One thing that I’ve always ignored are post meta fields. I’ve ignored them because they can be literally anything, often not in a ‘content way’ related to the post. This is working fine for posts but with the custom post type support in the Premium version I start getting the request for post meta support. Some other plugins or themes do store content related data in post meta fields and including these post meta fields will improve found related posts a lot.
Post Meta Filters
Related Posts for WordPress Premium 1.2.8 comes with two filters allowing you to include post meta fields in the process of finding related posts. For now this new feature comes without an UI. The filters are added so that developers can add Related Posts for WordPress support to their plugin or theme.
Adding Meta Fields
Meta fields can be added with the
The filter passes the post id and post object as arguments so you can only add meta fields for specific post types or even specific posts.
Setting Custom Meta Fields Weights
By default post meta fields have a weight of 20. With the filter
rp4wp_related_meta_fields_weight you can change this.
Please only change the weights of your own meta fields.
Exciting stuff ahead
I’m happy to say that the first plugin integration has already been made! WP Job Manager 1.19.0 and up integrates with Related Posts for WordPress allowing you to find the most related jobs! I’m excited about the new opportunities that this integration brings. I also plan on releasing version 1.3 of Related Posts for WordPress Premium this year which amongst other things bring cross post type related posts. Here’s a small peak of what that will look like: