Skip to main content
Agency Program Get 2× more leads and save 50% on hosting. Built for agencies ready to grow. Book a call
WP-PostRatings icon

WP-PostRatings

v1.91.2
by Lester Chan · 4.3 (179 reviews)

Adds an AJAX rating system for your WordPress site's content.

40K+ active installs Updated Jul 16, 2024 Tested to 6.6.2
Try Demo Download
Pre-installed Ready in ~10s No card
WP-PostRatings

About WP-PostRatings

This guide explains how to add ratings to your WordPress theme. You can add the ratings code to your theme files or use shortcodes to embed ratings into specific posts or pages. The plugin is available on GitHub and the developer accepts donations for their work.

Screenshots

WP-PostRatings screenshot
WP-PostRatings screenshot
WP-PostRatings screenshot
WP-PostRatings screenshot
WP-PostRatings screenshot
WP-PostRatings screenshot

Frequently asked questions

How do I add ratings to all posts or pages?
To add ratings to all posts or pages, locate the line <?php while (have_posts()) : the_post(); ?> in your theme's index.php, archive.php, single.php, post.php or page.php file. Then, add <?php if(function_exists('the_ratings')) { the_ratings(); } ?> anywhere below it where you want the ratings to appear.
How do I add ratings to a specific post or page?
To add ratings to a specific post or page, type [ratings] into the content of the selected post or page. This will embed ratings into that post or page only.
How can I display ratings from another post or page?
You can embed ratings from another post by using [ratings id="1"], where "1" is the ID of the post or page whose ratings you want to display. If you want to embed the results of other post ratings, use [ratings id="1" results="true"], where "1" is the ID of the post or page ratings results you wish to show.

Changelog

Version 1.91.2

  • FIXED: XSS in Google Rich Text Snippets

Version 1.91.1

  • FIXED: Read from default REMOTE_ADDR unless specified in options

Version 1.91

  • NEW: Supports specifying which header to read the user’s IP from

Version 1.90.1

  • FIXED: Support mutex lock for multi-site.

Version 1.90

  • FIXED: Use mutex lock to prevent race condition

Version 1.89.1

  • FIXED: Change all http://schema.org to https://schema.org

Version 1.89

  • NEW: Added post_id to second argument of wp_postratings_expand_ratings_template.
  • NEW Removed passed by reference for get_post()

Version 1.88

  • NEW: Added filter wp_postratings_disable_richsnippet to disable richsnippet on the fly.
  • NEW: Added a setting in WP-Admin -> Ratings -> Rating Options to disable the ratings component of the Rich Snippet. Props @8ctopus

Version 1.87

  • FIXED: Rename filter expand_ratings_template to wp_postratings_expand_ratings_template for consistency.
  • FIXED: Remove wp_print_scripts
  • FIXED: Added additional to Google Structured Data despite it is no longer working. Will consider removing it next time
  • NEW: Added wp_postratings_ipaddress and wp_postratings_hostname to allow user to overwrite it.
  • NEW: Add loading alt text filer
  • NEW: Add wp_postratings_always_log filter to allow user to always log no matter what

Version 1.86.2

  • FIXED: Wrong type check for inser_half which affects half rating image.

Version 1.86.1

  • FIXED: Sanitize file name for images folder in WP-Admin

Version 1.86

  • NEW: Hashed IP and Anonymize Hostname to make it GDPR compliance
  • NEW: If Do Not Log is set in Rating Options, do not log to DB

Version 1.85

  • NEW: wp_postratings_post_thumbnail filter
  • FIXED: Take into consideration logging method when dealing with ratings in comments
  • FIXED: Compressed Images

Version 1.84.1

  • NEW: New wp_postratings_google_structured_data filter to filter Google Structured Data.
  • FIXED: unnamed-file.numbers due to sanitize_file_name().
  • FIXED: Generate the full path to image to prevent Googlebot from 404.

Version 1.84

  • NEW: Added ‘%POST_THUMBNAIL%’ Template variable.
  • NEW: Added ‘wp_postratings_cookie_expiration’ filter. Props @ramiy.
  • NEW: Added ‘wp_postratings_ratings_image_alt’ filter
  • NEW: Added more meta itemprops to pass Structured Data Testing Tool test
  • NEW: Remove po/mo files from the plugin. Props @ramiy.
  • NEW: Use translate.wordpress.org to translate the plugin. Props @ramiy.
  • NEW: Add phpDocs and update file headers. Props @ramiy.
  • NEW: Adds the ability to restrict voting rights to members of the blog. Props @stephenharris.
  • FIXED: Use the new admin headings hierarchy with H1, H2, H3 tags. Props @ramiy.
  • FIXED: Move *.js files to /js/ sub-folder. Props @ramiy.
  • FIXED: Move *.css files to /css/ sub-folder. Props @ramiy.
  • FIXED: Move the scripts to a separate file in /includes/ sub-folder. Props @ramiy.
  • FIXED: Move the widget to a separate file in /includes/ sub-folder. Props @ramiy.
  • FIXED: Move the shortcode to a separate file in /includes/ sub-folder. Props @ramiy.
  • FIXED: Move activation hooks to a separate file in /includes/ sub-folder. Props @ramiy.
  • FIXED: Move admin functions and hooks to a separate file in /includes/ sub-folder. Props @ramiy.
  • FIXED: Move the i18n load to a separate file in /includes/ sub-folder. Props @ramiy.
  • FIXED: Replace die() with wp_die() and add i18n to the strings. Props @ramiy.
  • FIXED: Update translation strings to avoid using ‘post’ as the post type. Props @ramiy.
  • FIXED: Minor translation string fix. Props @ramiy.
  • FIXED: Update rating widget. Props @ramiy.
  • FIXED: Security hardening. Props @stephenharris.

Version 1.83.2

  • FIXED: Unauthenticated blind SQL injection in ratings_most_orderby(). Props @Ben Bidner from Automattic.

Version 1.83.1

  • FIXED: Remove No Results template from the_ratings_results()

Version 1.83

  • NEW: Added ‘wp_postratings_display_comment_author_ratings’ filter. Props @ramiy.
  • FIXED: Removing Loading … because SERP will index the text if the ratings is at the top of the article
  • FIXED: Move ‘wp_postratings_image_extension’ filter to init()
  • FIXED: Show headline, datePublished and image despite there is no ratings
  • FIXED: Show post without ratings as well when sorting is done in URL. Props @talljosh.

Version 1.82

  • NEW: Added ‘wp_postratings_image_extension’ filter. Props @ramiy.
  • FIXED: Added headline, datePublished, image to Article Schema type
  • FIXED: Deprecated PHP4 constructor in WordPress 4.3
  • FIXED: Remove schema code when Rich Snippets is off

Version 1.81

  • NEW: Added worstRating of 1. Props @rafaellop
  • NEW: Checked for defined() for RATINGS_IMG_EXT to allow overwrite
  • FIXED: Integration with WP-Stats

Version 1.80

  • NEW: Suppor Custom Post Types in Widgets
  • NEW: Added ‘wp_postratings_process_ratings_user’, ‘wp_postratings_process_ratings_userid’ & ‘wp_postratings_check_rated’ filters
  • NEW: Supports WordPress Multisite Network Activate
  • NEW: Uses WordPress native uninstall.php

Version 1.79

  • NEW: Use POST for ratings instead
  • NEW: Add ‘wp_postratings_schema_itemtype’ filter so that you can change the Schema Type. See the FAQ for sample.
  • FIXED: Use ‘is_rtl()’ instead of $text_direction

Version 1.78

  • NEW: Uses Dash Icons
  • NEW: Option to turn off Google Rich Snippets
  • FIXED: Use SITECOOKIEPATH instead of COOKIEPATH. Props jbrule.
  • FIXED: If global $id is 0, use get_the_ID(). Props instruite.
  • FIXED: use esc_attr() and esc_js() to escape characters

Version 1.77

  • NEW: Add in %POST_ID% template variables
  • FIXED: Ensure Google Rich Snippet only displays in main loop and not in the widget
  • FIXED: Removed reviewCount from Google Rich Snippet
  • FIXED: Make the ratings widget more optimized
  • FIXED: Some widget templates are using postratings_template_mostrated instead of postratings_template_highestrated

Version 1.76

  • FIXED: No longer needing add_post_meta() if update_post_meta() fails
  • FIXED: Update ‘Individual Rating Text/Value’ Display no working due to missing nonce
  • FIXED: Added stripslashes() to remove slashes in the templates
  • FIXED: Check whether it is an array to prevent array_key_exists() from throwing a warning.

Version 1.75

  • Change htmlspecialchars to esc_attr(). Props Ryan Satterfield.
  • Change esc_attr() to wp_kses() For itemprop. Props oneTarek.

Version 1.74

  • check_rated_username() should be using $user_ID. Props Artem Gordinsky.

Version 1.73

  • Add Stars Flat (PNG) Icons. Props hebaf.
  • Change Schema From http://schema.org/Product To http://schema.org/Article

Try other plugins

Yoast SEO icon

Yoast SEO

4.8 · 10M+ installs

Improve your WordPress SEO: Write better content and have a fully optimized WordPress site using the Yoast SEO…