1

I am trying to break my comments (reviews) on my single product page into various pages, having the latest comments displayed on top of each pages and the latest comments displayed on the first page / on the main page.

First, I tried using the comment settings (Break comments into pages...) from "Settings" > "Discussions", but it didn't work so I unchecked that option.

If I call

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

I see all of the comments, with the latest on top, which is what I am looking for. However, I would like to break that list into various pages since there are too many.

To do so, I tried to add

'per_page' => 4` 

to the arguments, but this shows the oldest comments on the first page.

Adding

'reverse_top_level' => true

only changes the order of the comment for that specific page, but not for the whole list.

The only way I found to display the latest comments as default when my page loads is to add

'page' => [my last page] 

However, if the number of comments is not a multiple of 4, it will display either 1, 2 or 3 comments.

Is there any way to achieve what I am looking for?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.