Apr 16, 2025 8:04 am
Hi, I don't know if it's normal but some users are abusing the replies.. how can I avoid users replying to their own comments?
1 Reply
Apr 17, 2025 8:59 am
Hi,
Use this hook code:Β
add_action("wpdiscuz_before_wp_new_comment", function ($commentdata) { if (!empty($commentdata["user_id"]) && !empty($commentdata["comment_parent"])) { $parent_comment = get_comment($commentdata["comment_parent"]); if ($parent_comment instanceof WP_Comment) { $parent_comment_user_id = (int)$parent_comment->user_id; $comment_user_id = (int)$commentdata["user_id"]; if ($parent_comment_user_id === $comment_user_id) { wp_die(esc_html__("You can not reply to own comment!", "wpdiscuz")); } } } });
Helpful article: https://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/