ristapk
ristapk

Reputation: 1372

Woocommerce product review redirect

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?

Upvotes: 1

Views: 559

Answers (1)

AleksandarPredic
AleksandarPredic

Reputation: 51

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

Upvotes: 1

Related Questions