• I want some (non-admin) users to be able to have their comments automatically approved, bypassing moderation, while everyone else is moderated. I have looked and looked and don’t see a way to do this, not even through plugins. Where do I start?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey, ks2019, you can use this code I produced as inspiration to achieve what you want:

    add_filter( 'pre_comment_approved' , 'bypass_moderation_filter' , '99', 2 );
    
    function bypass_moderation_filter( $approved , $commentdata )
    
    {
    
    $bypass_moderation_users = array(3);
    
    $user_ID = $commentdata['user_ID']; //list of user IDs that will bypass approval
    
    if (in_array($user_ID, $bypass_moderation_users))
    
    ? return 1; //comment is approved
    
    return $approved;
    
    }
    • This reply was modified 1 year, 9 months ago by Ian Sackofwits. Reason: clarification with code
    Thread Starter ks2019

    (@ks2019)

    My php skills are next to none, but thank you so much. I assume that this would go into functions.php? And that I would somehow need a method of putting the desired users into a list that would be (comma separated?) inside the single quoted ‘user_ID’ place in the code?

    Thread Starter ks2019

    (@ks2019)

    One idea I had was to put all the users I want to bypass moderation into a new user role called SubscriberPlus or something like that.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Allowing SOME users to bypass comment moderation’ is closed to new replies.