WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

By default, woocommerce product reviews are listed in chronological order. How do you get the newest review to appear first?

share|improve this question

closed as off-topic by kaiser Feb 20 '14 at 16:35

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 4 down vote accepted

I couldn't find this documented anywhere, but the solution is pretty simple.

In single_product_review.php, the arguments passed to wp_list_comments are filtered:

wp_list_comments( apply_filters( 'woocommerce_product_review_list_args', array( 'callback' => 'woocommerce_comments' ) ) );

by adding reverse_top_level to the arguments, the order is reversed.

Add the following code to your theme's functions.php:

// show newest product reviews on top
add_filter( 'woocommerce_product_review_list_args', 'newest_reviews_first' );
function newest_reviews_first($args) {
    $args['reverse_top_level'] = true;
    return $args;
}
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.