By default, a user with the ‘author’role can edit any comment made on any of his own posts. This is alright when you only have a handful of trusted authors.

In most cases though, you will want to allow authors to only edit their own comments. Here is a little snippet that achieves that (requires WordPress 3.1 or newer):

If you want to prevent authors from editing even their own comments, just remove this line from above:

if ( $comment->user_id != $user_id )

Reactions (1)

Comments (8)

  • Libby says:

    Where should I insert this code to work? Thanks

  • Libby says:

    Do you also know how can I disable quick edit for posts (for authors or for all users, it doesn’t matter)?
    Problem is that autors can add tags in quick edit, I don’t want this.

  • pete says:

    Hiya… sorry but this is a bit OT here but i’m after a way/plugin that only the author and commenter can see their own comments. Commenter A can’t see commenters B comments, or any replies to his comments for that matters (unless they’re comments from A)

  • milos says:

    The following will just remove links from the screen, but don’t forget to add above restrict_comment_editing snippet also.

    add_filter('comment_row_actions', array(&$this, 'remove_comment_edit'), 1, 2);
    
        public function remove_comment_edit($actions, $comment)
        {
            $user_id = get_current_user_id();
    
            if ($comment->user_id != $user_id) {
                unset($actions['edit']);
                unset($actions['quickedit']);
            }
    
            return $actions;
        }
    

Respond / add a comment


Subscribe without commenting