I’ve launched a new, light, one-page personal website, Radu.link, and I’m hosting it on NameCheap’s EasyWP managed WordPress hosting (affiliate link).


Here’s a NameCheap EasyWP review that I’ve written.

While setting up the site, I checked the comments section and noticed that the localhost IP,, was showing instead of the real IP.

localhost IP in WordPress comments

That was obviously not good, so I contacted the support team to get it fixed, and in this guide, I’ll share the solution with you.

Fix localhost IP showing in WordPress

Step 1

I recommend backing up the file or the whole website first!


You need to access your WordPress files and edit the wp-config.php file.

The file is normally in your root folder: public_html/wp-config.php.

If you’re doing this for an add-on domain, not your main one, it should normally be in public_html/YOURDOMAIN/wp-config.php.

edit wp-config.php wordpress file in cpanel
Editing wp-config.php file in cPanel

I’m using cPanel as an example, but truly managed WordPress web hosts don’t normally have cPanel.


Step 2

Add the below code right before the /* That's all, stop editing! Happy blogging. */ row.

Copy to Clipboard
code to show real ip in wordpress

Save the file and that’s it!

If you use any type of website caching, clear it before checking!

Tip: If it doesn’t work, move the code at the very bottom of the wp-config.php file.

This is how it worked in my case, by adding it at the very bottom.

The code is not made up by NameCheap’s support team.

They googled the issue and snatched the code from somewhere :) , which I could have done myself, but when things look a bit more complex to me, I don’t want to add random codes from Google.

That’s a wrap

Hope this worked for you and the real IP shows instead of the localhost IP in your WordPress website.

Don’t forget to share the post to help out others!

You can quickly subscribe to my newsletter by using this link.

If you have any questions or thoughts, drop a comment or send a message via contact or Facebook page.

You can also hit the follow button on Twitter and subscribe to the YouTube channel.

My WordPress services are at your disposal!