Function for getting the clients IP address
|Reported by:||hovenko||Owned by:||anonymous|
WordPress misses a function to get the IP address of the original client. It is critical to have a function like this when using plugins for voting, users online and when posting comments when WordPress runs on a server behind an HTTP proxy such as Varnish.
It checks if the header X-Forwarded-For is set (available from $_SERVER['HTTP_X_FORWARDED_FOR']) and uses the first address in this list. If it's not set, it uses $_SERVER['REMOTE_ADDR'] instead.
The function also applies a filter called "remote_ip_address" before returning the address.
Change History (13)
- Milestone 2.6 deleted
- Resolution set to invalid
- Status changed from new to closed
- Milestone set to 2.6
- Resolution invalid deleted
- Status changed from closed to reopened