1

I have a WordPress blog that gets a ton of comments. I have a freelancer that does support on the blog and replies to these comments. In a tryout phase, though, I'd like the comments of this support person to be manually approved by me.

How could this be done? Hold comments of a specific user in the moderation queue until approved?

1

1 Answer 1

1

If you are comfortable with coding, you could try a custom filter based on the WP_Comment object. Perhaps something like the following:

function wpse_wp_insert_comment($id, $comment) {    
        // Add your user_id, or use email address instead.
        if ( empty($comment->comment_author ) || $comment->user_id!== 1 )
            wp_set_comment_status( $comment, 'hold' );
}
add_action('wp_insert_comment', 'wpse_wp_insert_comment', 10, 2);

-Or ...

// Same method, but using userdata to compare email address instead
function wpse_wp_insert_comment($id, $comment) {    
    $author = empty($comment->comment_author) ? NULL : get_userdata($comment->user_id);
    // Be sure to update this line with YOUR actual email address.
    if ( empty($comment->comment_author ) || $author->user_email!=="[email protected]" )
        wp_set_comment_status( $comment, 'hold' );
}
add_action('wp_insert_comment', 'wpse_wp_insert_comment', 10, 2);

Extrapolated from a Tom Mcfarlin article "Programmatically Mark a Comment as Unapproved". See the "Gotcha" warning he throws out regarding users' anticipated outcome vs actual manipulated results caused by this type of function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.