Fix – WordPress Showing Localhost IP(127.0.0.1) for Comment Author Instead of Real

comment-author-ip

To fix this problem,

  1. Login to FTP/SFTP
  2. Go to public_html folder
  3. Edit wp-config.php
  4. Add below line
  5. Save Changes.
/** Required Code for showing correct IP address */
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { 
$xffaddrs = explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']); 
$_SERVER['REMOTE_ADDR'] = $xffaddrs[0]; 
}

Mark: This common problem I had noticed on Cloudways web hosting. However, it is very optimized for better performance.

Subscribe our blog via Email
Get instant updates of our new blog post directly at your Mailbox.

2 Comments

  1. Chala March 27, 2017 Reply

Add a Comment

Your email address will not be published. Required fields are marked *

Please don't use SMS lang. By commenting on this article, you agree to our .