Redirect First-Time Commenters
Redirect First-Time Commenters
PHP
function redirect_first_time_commenters($location, $comment) {
if ($comment->comment_approved === '1' && !$comment->user_id && !get_comments(array('author_email' => $comment->comment_author_email, 'count' => true))) {
$location = home_url('/thank-you-for-commenting/');
}
return $location;
}
add_filter('comment_post_redirect', 'redirect_first_time_commenters', 10, 2);
Snippet Feedback
Did this snippet work for you? Do you have any questions about this snippet? Leave some feedback below.
SHARED BY
2 Views