The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
replying to their o...
 
Share:
Notifications
Clear all

Limited Support

Our support team is currently on holiday from December 25, 2025 to January 7, 2026, and replies may be delayed during this period.

We appreciate your patience and understanding while our team is away. Thank you for being part of the wpDiscuz community!

Merry Christmas and Happy Holidays! πŸŽ„

Question replying to their own comments

2 Posts
2 Users
0 Reactions
392 Views
Posts: 4
Topic starter
(@big-old)
Active Member
Joined: 10 months ago

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
Asti
Posts: 8200
 Asti
Support
(@asti)
Illustrious Member
Joined: 8 years ago

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/


Reply
Share: