Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 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;
}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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