Documentation / General / Adjusting weights

Adjusting weights

By default Related Posts for WordPress has specific weights for titles, categories, tags and custom taxonomies. After a lot of testing we found these weights result in the best related posts suggestions.

Default weights

By default these weights are:

Title 80
Content 1
Links in content 20
Category 20
Tag 10
Custom Taxonomies 15

These numbers represent the ‘weight’ each word in the title/category/tag has, you can say each words gets multiplied by it’s weight.

Available Filters

We’ve added the following filters that allow you to change these weights:

  • rp4wp_weight_title
  • rp4wp_weight_cat
  • rp4wp_weight_tag
  • rp4wp_weight_custom_tax

Example of changing the title weight to 100

The follow code changes the title weight to 100, be sure to change the function name if you use this code on live websites.