Similar Posts


Unfortunately, due to ill-health, this plugin has not been developed or supported properly for some years. It works with the latest versions of WordPress (including on this website) but could possibly conflict with any WordPress features added after 2008 — e.g. custom post types — if you use them.


This plugin displays a list of posts which are related or similar to the current post.

This is version download latest version. It is compatible with WordPress 1.5–2.6.2.

Ideally, similarity or relatedness would be based on a post’s meaning. Tagging systems try to add meaning after the fact but suffer from two deficiencies, one practical and the other theoretical. When a blog already has many posts it can be impractical to retrofit a tagging system by tagging every post by hand. ‘Automatic’ services, like Yahoo’s, tend to produce too many suggestions which need to be culled, again by hand.

The theoretical problem with tagging is that it tries to pin down a meaning for a post by categorising it under a small number of types, whether those types belong to a predetermined hierarchy or arise by ‘folk’ classification. In fact, a post has a variety of meanings, a multitude of ways it can be related to other posts. Meaning doesn’t just lie in the intention of the author or in the classification of the reader; meaning also inhabits the text itself. Meaning is in the words.

The Similar Posts plugin compares posts by comparing their words. MySQL has a sophisticated full-text searching facility with a carefully tuned algorithm for judging the similarity between texts. Similar Posts extracts representative words from a post’s content, title, and tags and uses the full-text index to find the best matches between posts. This simple approach gives surprisingly good results.

The results can be tweaked in several ways to tailor them for you blog. By default the plugin chooses the 20 most frequent words to make its matches but the number is adjustable. It is worth experimenting to see how many words gives the best results for your blog — it has hardly any impact on speed, even if you set the value high enough to include the whole post. The relative importance given to words in your title may be adjusted so that well-chosen titles can be used to advantage or titles with little relevance downplayed. Similarly, tags can be used to improve matching or not according to your blog and it’s needs.

It is also possible to override the automatic similarity ranking by using a custom field. In the post edit screen create a custom field called ‘sp_similar’ with the ID value of the post to which you wish to ‘link’. You can link to multiple posts by entering a comma-delimited list of IDs.

The plugin has a settings page which lets you change how the output is generated and displayed. There is also a management page where you can change settings which affect the index.

Note: Similar Posts needs to know the ID of the post for which it is generating related posts. WordPress keeps track of that information in a global variable but unfortunately some other plugins can corrupt the data before Similar Posts gets a chance to use it. Similar Posts tries various tricks to get round this but sometimes it fails. The usual symptom is a list of similar posts that stays the same from page to page. You can help Similar Posts out by marking the current post manually by adding a line to your theme files. Find the place where the_content(); is used to display the current post and right after it put similar_posts_mark_current();.

Installation Instructions

  1. If upgrading from a previous version, first deactivate the plugin via the Plugins page and delete the plugin folder from your server.
  2. If you have been using the Similar Posts Feed plugin you should deactivate it as it is now obsolete.
  3. Upload the plugin folder to your /wp-content/plugins/ directory. You will also need to install the Post-Plugin Library.
  4. Go to your admin Plugins page and activate Similar Posts. This will automatically add a new table to enable fast, flexible full-text matching. If the plugin reports that there was a problem creating the table first try deactivating and reactivating the plugin.
  5. Put<!--?php similar_posts(); ?--> at the place in your theme files where you want the list of similar posts to appear. Lorelle on WordPress has a good guide to modifying themes for plugins.If you are averse to editing template files you can also place the post listing automatically either as a widget in the sidebar of your widget-aware theme or after each post (from the plugin’s Placement submenu).
  6. Use the admin Settings|Similar Posts pages to set all the available options. Alternatively, the options can be overridden by passing a parameter to the similar_posts template tag.

Usage and Options

The configuration page will help you to set up the plugin to your satisfaction.

The Index Management Page

Using this settings subpage you can re-index your blog. There are two main settings which affect the indexing.

PHP is, by default, not very good at handling text that isn’t in English and you might find Similar Posts mangles extended characters. If so, you can get the plugin to use PHP multi-byte string library if it is available.

The second setting attempts to handle words with related meanings. For example, ‘animal’ and ‘animals’ should probably not count as two distinct words, nor ‘follow’, ‘follows’, ‘following’, etc. You can choose to build the index using a stemming algorithm that groups such words as one (if there is one available for your language) or you can try the fuzzy matching algorithm. Whether it is better to be strict or to be relaxed will depend on your website.

A third setting is for blogs written mainly in Chinese, Korean, or Japanese. The MySQL fulltext index used by Similar Posts has problems with these languages but this setting tries several ways to work around the issues. The setting currently only works when posts are encoded as UTF-8. I would be very glad to get opinions from users familiar with these languages.

To avoid excessive memory use the indexing routine processes posts in batches of 100. This figure can be reduced to shrink the memory consumption even further.

Language Issues

The underlying MySQL full-text indexing is obviously very locale-dependent — how words are divided or punctuation handled, what words are treated as noise, etc. all vary from language to language. For the Similar Posts plugin to work well the version of MySQL on your server must be properly setup in the appropriate language.

Similar Posts generates the terms it matches on by analysing the word frequency of a post while ignoring the most common ‘noise’ words — in English, words like ‘of’, ‘and’, ‘across’, ‘someone’, etc. It uses a so-called ‘stop list’ of common English words to ignore. In fact it uses the stop list a standard English installation of MySQL uses. Obviously this list will be useless for other languages so Similar Posts makes the stop list pluggable.

The Similar_Posts folder contains a subfolder, ‘languages’, with stop lists and stemmers for a German, English, French, Spanish, and Italian. The plugin checks the WPLANG constant (defined in wp-config.php) to see which language WordPress is using and looks for a file on that basis. If WPLANG is undefined or the appropriate file cannot be found the default English list is used.

If you are looking for help setting up a stop list in a language other than English a good resource can be found at Stemmers in PHP are harder to come by. You can work out how to adapt any you find by inspecting the provided stemming files


  • 1. smellycat  |  May 21st, 2009 at 6:25 pm

    How can I chance the font’s size of the related posts?

  • 2. FreewareMatter  |  June 5th, 2009 at 7:16 pm

    How about the performance of this plugin? I mean, if it check the posts’ body to find related posts, it may cause the high load on server. I need a light related post plugin, can this plugin satisfy me?

  • 3. Marc (Webanhalter)  |  June 16th, 2009 at 7:22 pm

    Hi, do you still develop the plugins? Will it work under WordPress 2.8?

  • 4. craig  |  June 18th, 2009 at 12:10 pm


    when a new post is added the similar posts displays as none found, untill i click “Recreate Index” then the similar posts are displayed.

    How can i set the “Recreate Index” to auto run every time a new post is created, or if i set up a cron job what code would i execute?

  • 5. Joni  |  June 18th, 2009 at 3:23 pm

    >How about the performance of this plugin? I mean, if it check the posts’ body to find related posts, it may cause the high load on server. I need a light related post plugin, can this plugin satisfy me?

    I too would love to know if this wordpress plugin will cause high CPU usage.

    >Hi, do you still develop the plugins? Will it work under WordPress 2.8?

    This too — will it work right with WordPress 2.8 and are you still planning to keep it updated?

  • 6. Joni  |  June 18th, 2009 at 3:32 pm

    I too would love to know if this wordpress plugin will cause high CPU usage.

    This too — will it work right with WordPress 2.8 and are you still planning to keep it updated?

  • 7. Joni  |  June 26th, 2009 at 3:44 pm

    still would like to know if this works ok with 2.8 and how is the CPU usage?

  • 8. technochakra  |  July 2nd, 2009 at 9:02 am

    Just started using the plug-in. Very nice. Thanks for the effort you put into it.

  • 9. Angelo  |  August 3rd, 2009 at 6:19 am

    I upgraded wordpress, and now I see nothing coming up for related posts. Is anyone else having this problem, or did I do something wrong?

  • 10. Angelo  |  August 3rd, 2009 at 6:57 am

    Nevermind, it works fine… just a problem with my theme when updated.

  • 11. Helena  |  August 24th, 2009 at 8:43 pm

    Hello I love you plugins! all of them!

    Today i found this under Filter settings >> categories to exclude/include :
    Warning: str_repeat() [function.str-repeat]: Second argument has to be greater than or equal to 0 in /customers/ on line 593
    Is ‘t something to worry about?

    Thanks Helena

  • 12. çekmeköy kahvalti  |  August 15th, 2011 at 10:58 am

    Just started using the plug-in. Very nice. Thanks for the effort you put into it.

  • 13. Jeffrey Smith  |  August 24th, 2011 at 4:52 am

    Rob, I was having issues with this plugin, but found my answers here on your blog! Thank you for being so active in the success of your plugin and the success of others! Your plugin is really great for keeping people on my blog and delivering even more value! Really appreciate you!

  • 14. morrisjfwong  |  July 20th, 2013 at 3:12 pm

    Oh…try to use this plug in my blog, works well and reliable. Thank you for these sharing and openning. Great job!! Thanks you.