In WPPR, how do I...

Here are some of the hooks you can use with the WP Product Review plugin. Note that some of these customizations may require you to have the premium version of the plugin. To see the list of hooks and filters available for this plugin click here.

To apply these customizations, please see the details below:

  • Paste the below code snippets into the custom plugin created using the instructions here.
  • You can view more details about each hook mentioned here on this page.

Dynamically change the name of the review

By default, the product name for the review box can be set up in the "Product name" option from the WPPR settings and is independent of the post title.

Using the info from this document you will be able to change the product name of the review whenever you change the title of the post. You don't have to change both post title and product name. Changing the post title will dynamically change the product name of the review.

Here you have a code snippet that will do the trick:

add_filter( 'wppr_name','wppr_name_filter_demo',10,3 );

function wppr_name_filter_demo( $name, $id ) {
    // by default the cwp_rev_product_name meta field is used 
    // you can use this filter to change it to the post title and add the proper formatting
    return apply_filters( 'wppr_review_product_name_html' , get_the_title( $id ) );

Here's an example plugin that you can use: WPPR Review Name Change

Here's an example:


Dynamically change the pros/cons heading text

You can change the text for the "Pros" and "Cons" in WPPR to your desired text for your website using the wppr_review_pros_text and wppr_review_cons_text filters. You can also change dynamically the text, having a different one for each review. Below lists how to make the change.

In the examples below replace the  882  value with the ID of the post you want the change to happen. You can find the ID of a post in the URL of the page while editing a post:

If you'd like to style the output, use the following code:

//for pros

function wppr_review_pros_text_html_filter_demo() {
  if ( get_the_ID() == 882 ){
    echo '<span style="font-size:20px; color: #4682B4;">Advantages</span>';
    echo '<span style="font-size:20px">Pros</span>';

add_filter( 'wppr_review_pros_text','wppr_review_pros_text_html_filter_demo',11 );

//for cons

function wppr_review_cons_text_filter_demo() {
  if (get_the_ID() == 882){
    echo '<span style="font-size:20px">Disadvantages</span>';
    echo '<span style="font-size:20px">Cons</span>';

add_filter( 'wppr_review_cons_text','wppr_review_cons_text_filter_demo',11 );

If you'd just like to change the text then use this code instead:

//for pros

function wppr_review_pros_text_html_filter_demo( $name ) {
  if ( get_the_ID() == 882 ){
    return $name = "Advantages";
    return $name = "Pros";
add_filter( 'wppr_review_pros_text','wppr_review_pros_text_html_filter_demo',11,1 );

//for cons

function wppr_review_cons_text_filter_demo( $name ) {
  if ( get_the_ID() == 882 ){
    return "Disadvantages";
    return $name = "Cons";
add_filter( 'wppr_review_cons_text','wppr_review_cons_text_filter_demo',11,1 );


Dynamically change the image size for review

In order to display the image thumbnail in the review box, we are using the thumbnail image setting, which usually is 150x150 by default, to change this default you can go to Settings->Media, change the width and height then Force Regenerate Thumbnails using this plugin:

If your theme is making use of the default thumbnail value, then changing it would make the old images in the places where your theme uses that setting to display in the new size which you set.

In this situation, you will need to add a new image size in functions.php of your child theme and then use a filter to pass it to our plugin. If you don't have a child theme then you can use this plugin to create a quick site-specific plugin where you can add the code:

1. Add Image size 

add_image_size( 'new-size', 150, 150, true ); //(cropped)

2. Then you can use the    wppr_review_image_size filter. Here you have a code snippet that will do the trick.

add_filter( 'wppr_review_image_size','wppr_review_image_size_filter_demo',10,2 );
function wppr_review_image_size_filter_demo($post_id ) {
 	 //change the image size according to your needs;

	return "new-size"; //this is the actual name of the new size

Dynamically change the option name format

By default the options of the review are wrapped using the h3 tags. You can change to whatever tags fits your website using the wppr_option_name_html filter. Here is a code snippet that removes completely the html tag of the option. The first parameter of $id is the numeric id of the post used for review.

add_filter( 'wppr_option_name_html','wppr_option_name_html_filter_demo',11,2 );

function wppr_option_name_html_filter_demo( $id, $name = '' ) {
	$name = strip_tags ($name);
	return $name;

Manually change the rating of a review

If you want to display any other ratings than the one which is calculated, you can add the following snippet to the functions.php file of your theme or your child theme.

This example is for id 762 & 764. You can change these according to the post ids of which you want to change the review.

add_filter( 'wppr_rating', 'change_wppr_rating', 10, 3 );

function change_wppr_rating( $rating, $id, $model ) {
	if ( 762 == $id ) {
		return '8';
	if ( 764 == $id ) {
		return '9';
	return $rating;

Display whole number ratings instead of decimal ones

If you want to display a whole number rating for reviews instead of a decimal point number rating, add the following code snippet to your theme's function.php file: 

function change_wppr_rating( $rating, $id, $model ) {
	$new_rating = round( $rating / 10 );
	return $new_rating * 10;

add_filter( 'wppr_rating', 'change_wppr_rating', 10 );

Save the file, and you'll see all your review ratings will be the whole number.


Change the description of a review in the comparison table

You can add the following snippet to manually control the content you want to include in the description in the functions.php file of the theme or child theme. Please note that this will change the content of the review post with IDs 12 and 13. You can add similar conditions for more posts.

add_filter( 'wppr_content', 'custom_wppr_content_1', 10, 2 );

function custom_wppr_content_1( $content, $id ) {
	if ( $id == 12 ) {
		return 'something';
	if ( $id == 13 ) {
		return 'Just another description';
		return $content;

To control how many characters are displayed in the description, you can use the snippet below. The default is 55 and the snippet will change this to 100.

add_filter( 'excerpt_length', 'custom_excerpt_length_1' );

function custom_excerpt_length_1( $default ){
	// return the number of characters you want to set.	
	return 100;

Include ratings below 50 in the color band

 add_filter( 'wppr_comparison_table_rating_breakpoint', 60 );
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us