Skip to content →

Introducing tinyRatings

Please say „Hi!“ to the latest addition to my tinySomething family of WordPress plugins – tinyRatings. As the name suggests, this one is for rating stuff.

As a lot of things, the idea for this plugin came from client work. A few months ago, one guy asked me to develop a custom like/dislike voting plugin for posts on his site. Then a few weeks ago, another client wanted to be able to rate categories on his site. And there I remembered the Post Section Voting plugin, that a friend of mine has developed a few year back, but did not have the time to update anymore.

And that got me wondering – why ratings stuff is so complicated on WordPress? Sure, you can use Jetpack to turn on ‘likes’ system, but what if you don’t like Jetpack? Or want upvotes instead of likes? Or stars? There is also WP-PostRatings by Lester „GaMerZ“ Chan. It is a very popular plugin, but it is also an old one. It does get timely updates, but conceptually it hasn’t changed much for years. And it only works for posts, not taxonomy terms or anything else.

There are a lot of other ratings plugins on WordPress – if you search for „ratings“ in the plugin directory, you’ll get more than 100 pages of results. But somehow, none that I tried seemed right. What I wanted was a light, modern plugin, that had to do several key things right:

  • It should be fast and scalable;
  • It should use modern techniques – AJAX, iconfonts, Rest API;
  • It should work on more objects than just posts – taxonomy terms, sections in the posts, comments, etc.
  • It should be easily extendible, provide ways to create custom scales.

tinyRatings ticks pretty much all of those boxes. It does not (automatically) work on comments, but that is coming soon, to. But you can manually insert tinyRatings pretty much anywhere in the theme, and they will work. I use transients for caching, so it should scale pretty well. If you use object caching, tinyRatings will leverage that, and even if you don’t, it should be realtively light on the database. Rating results are pulled in via AJAX, so this plugin should play nice with pretty much any caching plugin there is. It also uses WP Rest API instead of admin-ajax.php so it should be a bit faster, too.

The rating snippets are small and simple, without any fancy styling – I’ve provided only minimal styles so the plugin shoud fit in nicely with most themes. It uses the WordPress native Dashicons icon font to display stars / thumbs up / etc., so it looks nice and fits in nicely with general look and feel of WordPress.

Under the hood there is also a modern way to identify voters – fingerprinting. This way users can be identified not only by their user ID, IP address that is too harsh in the times of shared IP addresses, or some cookie value that is pretty easy to circumvent, but also by a lot of markers of their system. Even if user clears his/her cookies, changes IP address, uses a proxy, uses browser incoginto mode, he or she can still be identified by their fingerprint. It uses a number of different features, like user agent, timezone, color depth, locale settings, etc. to generate an unique fingerprint. We use the FingerprintJS2 library to do that.

Anyway, one picture is worth a thousand words, so here is a live sample. Try to rate this article using 5 stars or thumbs up/down ratings below:


Or you can vote on list items:

  1. 3
    Item 1
  2. 3
    Item 2
  3. 5
    Item 3
  4. 5
    Item 4

And here you can see the top 3 best-rated articles of this blog:

  • Help me Build Free Plugins
  • Introducing Deployer
  • Introducing Content Cards

Note, that by default you can only see the ratings in top X list, not vote on them.

So, wait no more, grab a copy of tinyRatings from repository. And if you see any bugs or have new feature ideas, please open an issue on GitHub!

Download Feedback Become a Patron

Don’t forget to share this via , , Google+, LinkedIn and Reddit.


Published in Plugins