1

There is already a related question at How do I turn off wordpress comments ability to capture a users ip address?

But is there a solution to do it for users/mods/admins only?

So that normal anonymous visitors will have their IPs stored but registered users not.

1

Just add a check for the log in status:

add_filter( 'pre_comment_user_ip', 'wpse_53935_no_ip_for_logged_users');

function wpse_53935_no_ip_for_logged_users( $ip )
{
    return is_user_logged_in() ? 0 : $ip;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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