1
votes

I've created woocommerce product reviews as slider, where each review is one slide, but when I add a review, slider cannot do reinit. I found a way to redirect page without #comment-ID and there is a function:

add_filter('comment_post_redirect', 'redirect_after_comment');
function redirect_after_comment($location)
{

    $location = wp_get_referer();

    return $location;
}

But, this function redirect reviews on product page and comments on ordinary WP posts, but I like redirect to stay on ordinary WP posts. Is there a way to create redirect just for product reviews in woocommerce?

1

1 Answers

1
votes

Check if you are on custom post type single page using is_singular( 'product' ). At least that may be one of the solutions