Опис
WP-PostRatings adds a rating control to any post, page or custom post type. Visitors pick a value, the vote is posted in the background, and the result appears in its place without a page load.
Features
- Nine rating shapes, drawn with CSS rather than shipped as images, so they stay sharp at any size and cost no HTTP requests.
- A scale, or a two-way up/down control, with the rated and unrated colours as settings.
- Template tags and a shortcode for the highest rated, most rated, lowest rated and highest scoring posts, optionally within a category, a tag or a time range.
- A rating log with sortable columns, filters, bulk delete and Screen Options.
- Google rich snippet markup for the post and its aggregate rating.
- A sidebar widget, and a section on the WP-Stats page when that plugin is installed.
Пожертвування
Я присвятив більшу частину свого вільного часу створенню, оновленню, обслуговуванню та підтримці цих плагінів. Якщо ви справді любите мої плагіни і можете пошкодувати мені пару доларів, я буду дуже вдячний. Якщо ні, сміливо використовуйте його без будь-яких зобов’язань.
Використання
The simplest way, and the only one that works in a block theme without editing template files, is the shortcode. Put it in the post or page you want rated:
[ratings]rates the post it appears in.[ratings id="1"]shows the rating for post 1, wherever you put it.[ratings id="1" results="true"]shows post 1’s result without letting anyone vote from there.
To put ratings on every post automatically, a classic theme can call the template tag from single.php, archive.php or index.php, anywhere inside the loop:
<?php the_ratings(); ?>
The settings live at WP-Admin -> Ratings -> Settings, which has a Settings tab and a Templates tab.
Showing A Rating In A Block
A Ratings block is available in the editor, under Widgets. Two settings in the sidebar:
- Post ID — leave it at zero to rate the post the block sits in, which is what an empty
[ratings]does, or give an id to show another post’s rating wherever you put the block. - Show the result only — displays the rating without offering to change it, for putting a post’s score somewhere it should not be voted from. This is what
results="true"does.
It renders on the server, so the preview in the editor is the real rating rather than an approximation, and changing your shape, colours or templates updates every post showing it without re-saving anything. The preview is deliberately not clickable: rating from the editor would record a real vote.
The shortcode still works and is not going anywhere. [ratings], [ratings id="1"] and [ratings id="1" results="true"] behave exactly as they always have, and a post already containing one needs no change. The block calls the same code the shortcode calls, so the two render identically — use whichever suits the post.
WP-CLI
wp postratings list
wp postratings list --limit=50 --format=json
wp postratings get 42
wp postratings delete 42 --yes
wp postratings delete --all --what=logs
A rating lives in two places — the running totals each post displays, and a row per vote in the log. --what chooses which to clear: logs, data or both, and both is the default.
REST API
GET /wp-json/postratings/v1/post/<id>
POST /wp-json/postratings/v1/post/<id>/rate
Reading is public, because a rating is public. Rating takes the same wp_postratings_<id>-nonce the rendered control already carries, passed as a nonce parameter, and is subject to the same eligibility and repeat-rating settings as rating through the page.
Each response carries the rendered markup as well as the numbers, because your templates and your chosen shape decide what a rating looks like.
A refusal answers 403, not 400 — a rating already cast, a rating off the end of the scale, a bad nonce. 400 is kept for a parameter this plugin never had a chance to look at, and a post that does not exist is 404.
These routes are an addition. The admin-ajax.php wp_postratings action is unchanged and still supported.
Скріншоти





Блоки
Цей плагін надає 1 блок.
- Ratings A rating control for a post, or its result on its own.
Встановлення
- Install and activate the plugin.
- Go to
WP-Admin -> Ratings -> Settingsand choose the shape, the scale and who is allowed to rate. - Show the control: type
[ratings]into a post, add the Ratings block, or callthe_ratings()from your theme.
Часті питання
-
How do I change the colour of the ratings?
-
Go to
WP-Admin -> Ratings -> Settingsand look under Individual Rating Text and Value. Each step on the scale has its own pair of colour swatches, in the Rated and Not rated columns, which is what the oldstars_crystalandstars_darkimage sets were for.Hovering uses the rated colour. If you would rather tell “about to pick” apart from “already recorded”, set
--wp-postratings-color-hoverin your theme. -
How do I change the size, spacing or hover colour?
-
Anything beyond the two colours is a CSS custom property on
.wp-postratings, so this is all it takes in your theme:.wp-postratings { --wp-postratings-size: 24px; --wp-postratings-gap: 4px; --wp-postratings-color-hover: #f7c56b; }Before 2.0.0 a different colour meant a whole extra folder of images, which is why the plugin shipped
stars,stars_crystalandstars_darkseparately. They are all the same shape now. -
How do I use my own rating shape?
-
Register it with the
wp_postratings_shapesfilter. It then appears on the Ratings Options screen like any built-in shape, and unlike the old approach of dropping a folder intowp-content/plugins/wp-postratings/images/, it survives an update.add_filter( 'wp_postratings_shapes', function ( $shapes ) { $shapes['diamond'] = array( 'type' => 'scale', 'label' => 'Diamonds', 'path' => 'M12 2l10 10-10 10L2 12z', ); return $shapes; } );The path is SVG path data drawn in a 24×24 box. For an up/down control use
'type' => 'updown'and supply'up'and'down'paths instead of'path'. -
Every visitor can rate over and over, or every rating log entry shows the same IP
-
This is about the Header That Contains The IP field on the Ratings Options screen.
Leave it blank unless your site is genuinely behind a reverse proxy or CDN such as Cloudflare. Blank means the plugin uses the address your web server actually saw, which is what you want on a normal host.
If you are behind a proxy, name the exact header your proxy sets, for example
HTTP_CF_CONNECTING_IPfor Cloudflare orHTTP_X_FORWARDED_FORfor most load balancers. Two things are worth knowing:- A visitor can send any header they like. If you name a header your own stack does not set and overwrite, anyone can put whatever they want in it and rate as many times as they please.
X-Forwarded-Foris a list,client, proxy1, proxy2. As of 2.0.0 the plugin reads the first valid address in that list rather than storing the whole string. Before 2.0.0 it stored the whole string, which meant a visitor could append one more address and appear to be somebody new on every request.
Because the stored value has changed shape, rating logs recorded through such a header before 2.0.0 will not match any more, and some visitors may be able to rate one more time. Logs recorded without the field set are unaffected.
-
Як змінити тип Схеми?
-
<?php add_filter( 'wp_postratings_schema_itemtype', 'wp_postratings_schema_itemtype' ); function wp_postratings_schema_itemtype( $itemtype ) { return 'itemscope itemtype="https://schema.org/Recipe"'; } ?>Тип схеми за замовчуванням – “Стаття”, якщо ви хочете змінити його на “Рецепт”, вам потрібно скористатися фільтром
wp_postratings_schema_itemtype, як показано в прикладі коду вище. -
Як додати логотип свого сайту для Google Rich Snippets
-
<?php add_filter( 'wp_postratings_site_logo', 'wp_postratings_site_logo' ); function wp_postratings_site_logo( $url ) { return 'https://example.com/logo.png'; } ?>За замовчуванням плагін використовуватиме URL-адресу зображення заголовка вашого сайту як логотип вашого сайту. Якщо ви хочете змінити його, вам потрібно скористатися фільтром
wp_postratings_site_logo, як показано у прикладі коду вище. -
How To Change The Text Screen Readers Announce?
-
add_filter( 'wp_postratings_ratings_image_alt', function ( $label ) { return $label; } );This is the description a screen reader reads out for a displayed rating, such as “4 votes, average: 3.70 out of 5”. Since 2.0.0 the ratings are drawn with CSS rather than images, so there is no
altortitleattribute involved; the value becomes thearia-labelon the rating.Returning an empty string removes it, which is what this filter was usually used for. Be aware that it leaves the rating with no accessible name at all, so anyone using a screen reader is told nothing about it. Prefer rewording it over removing it.
-
add_filter( 'wp_postratings_display_comment_author_ratings', '__return_true' );За замовчуванням оцінки авторів коментарів не відображаються. Якщо ви хочете відобразити оцінки, вам потрібно скористатися фільтром
wp_postratings_display_comment_author_ratings, як показано у прикладі коду вище. -
function custom_rating_cookie_expiration() { return strtotime( 'tomorrow' ) ; } add_filter( 'wp_postratings_cookie_expiration', 'custom_rating_cookie_expiration', 10, 0 );За замовчуванням термін дії кукі-файлів ‘time() + 30000000’, якщо ви хочете змінити тривалість експерименту, вам потрібно скористатися фільтром
wp_postratings_cookie_expiration, як показано у прикладі коду вище. -
Як WP-PostRatings завантажує CSS?
-
Most restyling needs no CSS file at all any more: the colours are a setting, and the size, spacing and hover colour are custom properties. See the two questions above first.
If you do want to replace the stylesheet wholesale, WP-PostRatings loads
wp-postratings.cssfrom your theme’s directory (or itscss/subdirectory) when that file exists, and its own copy otherwise, so an upgrade will not overwrite your styles.Note the filename changed in 2.0.0: it was
postratings-css.cssbefore. A theme still shipping the old name is simply ignored, and the plugin’s own stylesheet loads instead. There is no separate RTL stylesheet any more either, because the rules use logical properties. -
Як використовувати статистику рейтингів за допомогою Віджетів?
-
- Перейдіть до
WP-Admin -> Зовнішній вигляд -> Віджети - Назва віджету – Рейтинги.
- Перейдіть до
-
Показати пости з найнижчим рейтингом
-
<?php if (function_exists('get_lowest_rated')): ?> <ul> <?php get_lowest_rated(); ?> </ul> <?php endif; ?>- За замовчуванням: get_lowest_rated(‘both’, 0, 10)
- Значення ‘both’ покаже, як пости, так і сторінки з найнижчим рейтингом.
- Якщо ви хочете показувати лише дописи з найнижчим рейтингом, замініть “both” на “post”.
- Якщо ви хочете показати лише сторінки з найнижчим рейтингом, замініть “both” на “page”.
- Значення 0 означає мінімальну кількість голосів, необхідну для того, щоб публікація була показана.
- Значення 10 покаже лише 10 дописів/сторінок з найнижчим рейтингом.
-
Щоб відобразити пости з Найнижчим рейтингом за Тегом
-
<?php if (function_exists('get_lowest_rated_tag')): ?> <ul> <?php get_lowest_rated_tag(TAG_ID); ?> </ul> <?php endif; ?>- За замовчуванням: get_lowest_rated_tag(TAG_ID, ‘both’, 0, 10)
- Замініть TAG_ID на ваш ідентифікатор тегу. Якщо ви хочете, щоб він охоплював кілька категорій, замініть TAG_ID на array(1, 2), де 1 і 2 – це ідентифікатори ваших категорій.
- Значення ‘both’ покаже, як пости, так і сторінки з найнижчим рейтингом.
- Якщо ви хочете показувати лише дописи з найнижчим рейтингом, замініть “both” на “post”.
- Якщо ви хочете показати лише сторінки з найнижчим рейтингом, замініть “both” на “page”.
- Значення 0 означає мінімальну кількість голосів, необхідну для того, щоб публікація була показана.
- Значення 10 покаже лише 10 дописів/сторінок з найнижчим рейтингом.
-
Відображати пости з найнижчим рейтингом у Категорії
-
<?php if (function_exists('get_lowest_rated_category')): ?> <ul> <?php get_lowest_rated_category(CATEGORY_ID); ?> </ul> <?php endif; ?>- За замовчуванням: get_lowest_rated_category(CATEGORY_ID, ‘both’, 0, 10)
- Замініть CATEGORY_ID на ідентифікатор вашої категорії. Якщо ви хочете, щоб він охоплював кілька категорій, замініть CATEGORY_ID на array(1, 2), де 1 і 2 – це ідентифікатори ваших категорій.
- Значення ‘both’ покаже, як пости, так і сторінки з найнижчим рейтингом.
- Якщо ви хочете показувати лише дописи з найнижчим рейтингом, замініть “both” на “post”.
- Якщо ви хочете показати лише сторінки з найнижчим рейтингом, замініть “both” на “page”.
- Значення 0 означає мінімальну кількість голосів, необхідну для того, щоб публікація була показана.
- Значення 10 покаже лише 10 дописів/сторінок з найнижчим рейтингом.
-
Щоб відобразити пости з Найвищим рейтингом
-
<?php if (function_exists('get_highest_rated')): ?> <ul> <?php get_highest_rated(); ?> </ul> <?php endif; ?>- За замовчуванням: get_highest_rated(‘both’, 0, 10)
- Значення ‘both’ покаже, як найбільш рейтингові пости, так і сторінки.
- Якщо ви хочете показати лише найбільш рейтингові дописи, замініть ‘both’ на ‘post’.
- Якщо ви хочете показати лише найбільш рейтингові сторінки, замініть ‘both’ на ‘page’.
- Значення 0 означає мінімальну кількість голосів, необхідну для того, щоб публікація була показана.
- Значення 10 покаже лише 10 постів/сторінок з найвищим рейтингом.
-
Щоб відобразити пости з Найвищим рейтингом за Тегом
-
<?php if (function_exists('get_highest_rated_tag')): ?> <ul> <?php get_highest_rated_tag(TAG_ID); ?> </ul> <?php endif; ?>- За замовчуванням: get_highest_rated_tag(TAG_ID, ‘both’, 0, 10)
- Замініть TAG_ID на ваш ідентифікатор тегу. Якщо ви хочете, щоб він охоплював кілька категорій, замініть TAG_ID на array(1, 2), де 1 і 2 – це ідентифікатори ваших категорій.
- Значення ‘both’ покаже, як найбільш рейтингові пости, так і сторінки.
- Якщо ви хочете показати лише найбільш рейтингові дописи, замініть ‘both’ на ‘post’.
- Якщо ви хочете показати лише найбільш рейтингові сторінки, замініть ‘both’ на ‘page’.
- Значення 0 означає мінімальну кількість голосів, необхідну для того, щоб публікація була показана.
- Значення 10 покаже лише 10 постів/сторінок з найвищим рейтингом.
-
Відобразити пости з Найбільшою кількістю балів рейтингу в Категорії
-
<?php if (function_exists('get_highest_rated_category')): ?> <ul> <?php get_highest_rated_category(CATEGORY_ID); ?> </ul> <?php endif; ?>- За замовчуванням: get_highest_rated_category(CATEGORY_ID, ‘both’, 0, 10)
- Замініть CATEGORY_ID на ідентифікатор вашої категорії. Якщо ви хочете, щоб він охоплював кілька категорій, замініть CATEGORY_ID на array(1, 2), де 1 і 2 – це ідентифікатори ваших категорій.
- Значення ‘both’ покаже, як найбільш рейтингові пости, так і сторінки.
- Якщо ви хочете показати лише найбільш рейтингові дописи, замініть ‘both’ на ‘post’.
- Якщо ви хочете показати лише найбільш рейтингові сторінки, замініть ‘both’ на ‘page’.
- Значення 0 означає мінімальну кількість голосів, необхідну для того, щоб публікація була показана.
- Значення 10 покаже лише 10 постів/сторінок з найвищим рейтингом.
-
Відображати найрейтинговіші пости за певний період
-
<?php if (function_exists('get_highest_rated_range')): ?> <ul> <?php get_highest_rated_range('1 day'); ?> </ul> <?php endif; ?>- За замовчуванням: get_highest_rated_range(‘1 day’, ‘both’, 10)
- Значення “1 день” буде тим діапазоном, який ви хочете. Ви можете використовувати “2 дні”, “1 місяць” тощо.
- Значення ‘both’ покаже, як найбільш рейтингові пости, так і сторінки.
- Якщо ви хочете показати лише найбільш рейтингові дописи, замініть ‘both’ на ‘post’.
- Якщо ви хочете показати лише найбільш рейтингові сторінки, замініть ‘both’ на ‘page’.
- Значення 10 покаже лише 10 найрейтинговіших постів/сторінок.
-
Показати найрейтинговіші пости
-
<?php if (function_exists('get_most_rated')): ?> <ul> <?php get_most_rated(); ?> </ul> <?php endif; ?>- За замовчуванням: get_most_rated(‘both’, 0, 10)
- Значення ‘both’ покаже, як найбільш рейтингові пости, так і сторінки.
- Якщо ви хочете показати лише найбільш рейтингові дописи, замініть ‘both’ на ‘post’.
- Якщо ви хочете показати лише найбільш рейтингові сторінки, замініть ‘both’ на ‘page’.
- Значення 0 означає мінімальну кількість голосів, необхідну для того, щоб публікація була показана.
- Значення 10 покаже лише 10 найрейтинговіших постів/сторінок.
-
Відображати найрейтинговіші пости в Категорії
-
<?php if (function_exists('get_most_rated_category')): ?> <ul> <?php get_most_rated_category(CATEGORY_ID); ?> </ul> <?php endif; ?>- За замовчуванням: get_most_rated_category(CATEGORY_ID, ‘both’, 0, 10)
- Замініть CATEGORY_ID на ідентифікатор вашої категорії. Якщо ви хочете, щоб він охоплював кілька категорій, замініть CATEGORY_ID на array(1, 2), де 1 і 2 – це ідентифікатори ваших категорій.
- Значення ‘both’ покаже, як найбільш рейтингові пости, так і сторінки.
- Якщо ви хочете показати лише найбільш рейтингові дописи, замініть ‘both’ на ‘post’.
- Якщо ви хочете показати лише найбільш рейтингові сторінки, замініть ‘both’ на ‘page’.
- Значення 0 означає мінімальну кількість голосів, необхідну для того, щоб публікація була показана.
- Значення 10 покаже лише 10 найрейтинговіших постів/сторінок.
-
Відображати Найрейтинговіші пости за певний період
-
<?php if (function_exists('get_most_rated_range')): ?> <ul> <?php get_most_rated_range('1 day'); ?> </ul> <?php endif; ?>- За замовчуванням: get_most_rated_range(‘1 day’, ‘both’, 10)
- Значення “1 день” буде тим діапазоном, який ви хочете. Ви можете використовувати “2 дні”, “1 місяць” тощо.
- Значення ‘both’ покаже, як найбільш рейтингові пости, так і сторінки.
- Якщо ви хочете показати лише найбільш рейтингові дописи, замініть ‘both’ на ‘post’.
- Якщо ви хочете показати лише найбільш рейтингові сторінки, замініть ‘both’ на ‘page’.
- Значення 10 покаже лише 10 найрейтинговіших постів/сторінок.
-
Показати постів з Найбільшою кількістю балів
-
<?php if (function_exists('get_highest_score')): ?> <ul> <?php get_highest_score(); ?> </ul> <?php endif; ?>- За замовчуванням: get_highest_score(‘both’, 0, 10)
- Значення ‘both’ покаже, як найбільш рейтингові пости, так і сторінки.
- Якщо ви хочете показати лише найбільш рейтингові дописи, замініть ‘both’ на ‘post’.
- Якщо ви хочете показати лише найбільш рейтингові сторінки, замініть ‘both’ на ‘page’.
- Значення 0 означає мінімальну кількість голосів, необхідну для того, щоб публікація була показана.
- Значення 10 покаже лише 10 найрейтинговіших постів/сторінок.
-
Відобразити публікацію з Найбільшою кількістю балів у Категорії
-
<?php if (function_exists('get_highest_score_category')): ?> <ul> <?php get_highest_score_category(CATEGORY_ID); ?> </ul> <?php endif; ?>- За замовчуванням: get_highest_score_category(CATEGORY_ID, ‘both’, 0, 10)
- Замініть CATEGORY_ID на ідентифікатор вашої категорії. Якщо ви хочете, щоб він охоплював кілька категорій, замініть CATEGORY_ID на array(1, 2), де 1 і 2 – це ідентифікатори ваших категорій.
- Значення ‘both’ покаже, як найбільш рейтингові пости, так і сторінки.
- Якщо ви хочете показати лише найбільш рейтингові дописи, замініть ‘both’ на ‘post’.
- Якщо ви хочете показати лише найбільш рейтингові сторінки, замініть ‘both’ на ‘page’.
- Значення 0 означає мінімальну кількість голосів, необхідну для того, щоб публікація була показана.
- Значення 10 покаже лише 10 найрейтинговіших постів/сторінок.
-
Відображати пости з Найвищим рейтингом за певний період
-
<?php if (function_exists('get_highest_score_range')): ?> <ul> <?php get_highest_score_range('1 day'); ?> </ul> <?php endif; ?>- Типове значення: get_highest_score_range(‘1 day’, ‘both’, 10)
- Значення “1 день” буде тим діапазоном, який ви хочете. Ви можете використовувати “2 дні”, “1 місяць” тощо.
- Значення ‘both’ покаже, як найбільш рейтингові пости, так і сторінки.
- Якщо ви хочете показати лише найбільш рейтингові дописи, замініть ‘both’ на ‘post’.
- Якщо ви хочете показати лише найбільш рейтингові сторінки, замініть ‘both’ на ‘page’.
- Значення 10 покаже лише 10 найрейтинговіших постів/сторінок.
-
Щоб сортувати пости з Найвищим/Найнижчим Рейтингом
-
$query = new WP_Query( array( 'meta_key' => 'ratings_average', 'orderby' => 'meta_value_num', 'order' => 'DESC', ) );Або передайте змінні URL-адресі:
http://yoursite.com/?r_sortby=highest_rated&r_orderby=descReplace
descwithascfor the lowest rated posts. -
Сортування дописів з Найбільшим/Найменшим Рейтингом
-
$query = new WP_Query( array( 'meta_key' => 'ratings_users', 'orderby' => 'meta_value_num', 'order' => 'DESC', ) );Або передайте змінні URL-адресі:
http://yoursite.com/?r_sortby=most_rated&r_orderby=descReplace
descwithascfor the least rated posts.These examples use
WP_Queryrather thanquery_posts(), which the old ones called:query_posts()replaces the main query and WordPress has discouraged it for years. To sort the main query instead, usepre_get_posts.
Відгуки
Учасники та розробники
“WP-PostRatings” — проект з відкритим вихідним кодом. В розвиток плагіну внесли свій вклад наступні учасники:
Учасники“WP-PostRatings” було перекладено на 14 локалізацій. Дякуємо перекладачам за їх роботу.
Перекладіть “WP-PostRatings” на вашу мову.
Цікавитесь розробкою?
Перегляньте код, перегляньте сховище SVN або підпишіться на журнал розробки за допомогою RSS.
Журнал змін
2.0.0
- FIXED: Any post ID could be rated, not only a published one. A visitor who was never signed in could seed
ratings_users,ratings_scoreandratings_averageonto a draft, a pending, a private or a trashed post — so it arrived already rated on the day it was published — and the unpublished title was copied into the log table, where the Logs screen then displayed it. On a site that had put%POST_TITLE%or%POST_CONTENT%into the text template, the reply returned unpublished content directly. Both the AJAX action and the REST route now require a post that is actually publicly viewable - NEW: A
wp postratingsWP-CLI command —list,getanddelete, with--what=logs|data|both. - NEW: A
postratings/v1REST API for reading a post’s rating and casting one. Theadmin-ajax.phpwp_postratingsaction is unchanged and still supported. - NEW: A Ratings block for the editor, with the post id and a results-only toggle in the sidebar. It renders on the server through the same code the shortcode does, so the editor preview is the real rating. The
[ratings]shortcode is unchanged and still supported — the block is an addition beside it, nothing needs migrating, and posts already holding a shortcode need no edit. - BREAKING: Requires WordPress 6.8 and PHP 8.2, up from 6.0 and 7.4.
- BREAKING: The rating images are gone. All 16 image sets and their 121 GIF and PNG files are replaced by 9 SVG shapes drawn with CSS, so ratings are sharp on every screen and cost no HTTP requests. Your chosen set is migrated automatically to the matching shape: stars, stars_crystal, stars_dark, stars_png and stars_flat_png all become
star, thumbs becomesthumb, and so on. If you added your own folder toimages/it will fall back to stars; see the FAQ for how to register a custom shape properly, which unlike the old folder survives an update. - BREAKING: The rating markup has changed completely. A scale is now a group of radio buttons and an up/down is a pair of buttons, so the control announces itself correctly to screen readers and works from the keyboard. Every class and element id is now prefixed with the plugin slug:
.post-ratingsis.wp-postratings,.post-ratings-imageno longer exists at all, and the wrapper id iswp-postratings-123rather thanpost-ratings-123. Colour, size and spacing are CSS custom properties, which is usually a one-line replacement; see the FAQ. - BREAKING: The vote images no longer carry inline
onmouseover/onclickattributes; hovering and clicking are handled by one delegated listener. Custom CSS or JavaScript that targeted those inline handlers, or that calledcurrent_rating()orrate_post()directly, needs updating. - BREAKING: The
rate_postaction is renamedwp_postratings_rate_postand the old name is gone, with no deprecation shim. Its three arguments are unchanged. - BREAKING: Every class is renamed to
WP_PostRatings_*, and the plugin’s own classes are no longer calledPostratings_*.RATINGS_IMG_EXTis nowWP_POSTRATINGS_IMG_EXT. - BREAKING: The settings screen moved to
WP-Admin -> Ratings -> Settings, atadmin.php?page=wp-postratings-settings. Ratings Options and Ratings Templates are the two tabs of that one page rather than two menu entries. - BREAKING: The option rows are renamed. The fifteen
postratings_*rows become onewp_postratings_options, and the two separate version markers become onewp_postratings_version. Your settings are migrated automatically on the first load after the update. - BREAKING: The shared, unprefixed
stats_displayandstats_mostlimitoption rows are no longer read. WP-Stats integration is now two settings of this plugin’s own, on the Settings tab, and WP-Stats asks each plugin for its section through thewp_stats_sectionsfilter rather than reading anybody’s options. Update all seven WP-Stats-aware plugins together; see the Upgrade Notice. - BREAKING: If you set “Header That Contains The IP” (for Cloudflare, a load balancer or any reverse proxy), that header is now parsed as the forwarded-for chain it is, and only the first valid address in it is used. Previously the whole header value was stored, so a visitor could rate repeatedly just by appending another address to it. Existing rating logs recorded through such a header will no longer match, so some visitors may be able to rate once more. Leave the field blank unless you are actually behind a proxy. See the FAQ.
- BREAKING: “Ratings Logging Method” is now “Check For Repeat Votes”, and it no longer decides whether anything is logged. It never did anything but choose what a returning visitor is matched against, and the two readings pointed opposite ways: a site that picked “Do Not Log” or “Logged By Cookie” got no ratings log, no rows on the logs screen and no WP-Stats figures, which is not what either choice sounds like. Every vote is now recorded whatever this is set to. The choices read “Do Not Check”, “Check By Cookie”, “Check By IP Address”, “Check By Cookie And IP Address” and “Check By Username”; the stored numbers are unchanged, so your setting means what it always meant. The option key inside
wp_postratings_optionsischeck_methodrather thanlogging_method, migrated automatically. - BREAKING: The
wp_postratings_always_logfilter is gone. It asked for exactly the behaviour above, which is now the default, and a filter that forces the default does nothing. Sites that would rather not keep the record have the opposite filter instead: return false fromwp_postratings_log_ratingand no row is written. The post’s own score and vote count are post meta and are updated either way. - BREAKING: The stylesheet is now
wp-postratings.css, notpostratings-css.css, and there is no separate RTL stylesheet. If your theme ships its ownpostratings-css.cssoverride it will no longer be picked up; rename it, or better, use the colour setting and the CSS custom properties instead. - NEW: Rewritten as classes under
includes/, so the plugin now works installed under any directory name. - NEW: Settings moved to the WordPress Settings API, with the options and templates screens merged into one tabbed page.
- NEW: The rating log is now a standard WordPress list table, with sortable columns, bulk delete, a search box and Screen Options.
- NEW: The scripts are vanilla JavaScript; the jQuery dependency is gone, and hovering the stars is pure CSS, so nothing runs on mouse move at all.
- NEW: Rating colours are a setting, per rating rather than per site: each row of the rating table has its own rated and not-rated colour, with a Reset to default beside them. This replaces the old colour variants of the image sets, where changing colour meant choosing a different set of files.
- NEW:
wp_postratings_shapeslets you register your own rating shape. - NEW:
WP_POSTRATINGS_TRUST_PROXYand thewp_postratings_trust_proxyfilter opt into the usual reverse-proxy headers without naming one. “Header That Contains The IP” stays the narrow answer — exactly the one header your proxy sets — and still wins when both are given; the constant is the broad one, meaning “try the seven headers proxies commonly use”. WP-Email, WP-Polls, WP-Ban and WP-UserOnline already worked this way; WP-PostRatings was the one that did not. - NEW:
wp_postratings_capabilityfilters the capability the plugin’s screens require, which is stillmanage_ratings. - NEW: The stylesheet honours
prefers-color-scheme: dark,prefers-contrast: moreandprefers-reduced-motion: reduce. - CHANGED: Ratings display a true percentage instead of being rounded to the nearest half image, so an average of 3.7 out of 5 now fills 74% of the stars rather than showing three and a half.
- CHANGED:
RATINGS_IMG_EXTandwp_postratings_image_extensionno longer choose anything; there are no image files left to have an extension. Thewp_postratings_ratings_image_altfilter stays, but it now sets the rating’s accessible label rather than an image’s alt and title text. - FIXED: The plugin requested an admin stylesheet that had been an empty file since 2020.
- FIXED: The per-post lock file was never released, so one was left behind in the server’s temporary directory on every single rating.
- FIXED: Uninstalling on a multisite network stopped after the first 100 sites, leaving the options and the rating table behind on every site after that.
- FIXED: Activating network-wide also stopped after 100 sites.
- FIXED: A rating outside the configured scale was recorded as a vote worth nothing, and warned on PHP 8.
- FIXED: Comment author ratings never matched by IP, so they had been silently broken since ratings began being stored hashed.
- FIXED: The “numbers” rating image set could not be saved; it reported success and reverted to stars.
- FIXED: Post titles containing an apostrophe were stored in the log with a stray backslash.
- FIXED: The rating log always claimed to be sorted “Descending” whichever order was chosen.
- FIXED: Deleting all rating data left every post’s cache holding the values that had just been removed.
- FIXED: Numerous PHP 8 warnings on the admin screens and in an unconfigured widget.
- NEW: When an up/down post has no verdict to show, it shows you your own vote instead. A tie points nowhere, so rating a post down and landing on one drew a blank pair that looked exactly like the control you had just clicked — as though the vote had not been recorded. Your vote is the only direction that can honestly be attributed at that point, so it takes the shape and the label reads “You rated this down”. A post that does have a verdict keeps showing it: one that is 500 to 3 in favour must not read as a thumbs down to the single visitor who disagreed. Your vote comes from the “already rated” cookie, or from the rating log when the repeat-vote check is by username. It is deliberately never matched by IP address: behind a proxy or a mobile network many visitors share one address, so that would tell somebody who had never voted that they had
- FIXED: An up/down rating with no verdict was drawn as a vote down. Zero is not a direction: a post nobody has rated, and a post with as many down votes as up, both average zero, and both showed a lit thumbs down. They now show the pair unlit. This also fixes what a site sees after switching from a scale to an up/down control — an up/down vote is worth -1 or +1, so a score off a scale of stars is far too large to be one, and reading it as a direction showed every previously rated post as a thumbs up that no amount of voting down could shift. Such a post now shows the unlit pair until its up/down votes outweigh its history, and the vote count and score are reported exactly as stored throughout
- FIXED: On a dark colour scheme the unrated shapes stayed the light grey chosen for a light page, and glared. The dark default is a custom property set on the container
the_ratings()adds — but the widget, and the shortcode and block when asked for results only, print the rating without that container, so nothing they drew ever inherited it. The same was true of the high-contrast default
