WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Prevent a post's author from commenting (2 posts)

  1. ntoqiakt
    Member
    Posted 1 year ago #

    Hi all,

    I'm working on a site where I have a group of users just with read and edit_post capability. Their posts are checked and published by their category admins who also moderate the comments.

    I noticed though that once the post was published the authors could go back and comment without moderation. Is there a way to prevent this from happening? Ie, require moderation even for the post authors?

    Thanks

  2. ntoqiakt
    Member
    Posted 1 year ago #

    I guess my title wasn't very accurate... however after lots of a searching I managed to find the solution. All credit goes to housebg for posting the solution here:

    Comment Moderation Issue - need help

    I'll add it here just in case it helps anyone:

    add_filter('pre_comment_approved', 'xko_pre_comment_approved', null, 2);
    function xko_pre_comment_approved($approved, $commentdata)
    {
        $approved = 0;
    
      return $approved;
    }

Topic Closed

This topic has been closed to new replies.

About this Topic