I am using cloudflare and the IP address that WordPress track under the comment is not the actual IP address of the visitor. I already have the code to replace so I can track the real IP address. But I don't know where to change this in WordPress. Anyone knows about this? Thank you in advance.
The way I understand how CloudFlare works is it sits between you and the outside world, like a firewall. If CloudFlare is not transmitting the actual IP address to WordPress, then there is no way for you to get it. Look into CloudFlare docs and see if there is a setting that will allow the actual IP address to come through -- either that, or just not use the service.