[wp-trac] Re: [WordPress Trac] #4602: Function for getting the clients IP address

WordPress Trac wp-trac at lists.automattic.com
Tue Jul 10 16:16:10 GMT 2007

#4602: Function for getting the clients IP address
 Reporter:  hovenko      |        Owner:  anonymous  
     Type:  enhancement  |       Status:  new        
 Priority:  normal       |    Milestone:  2.3 (trunk)
Component:  General      |      Version:             
 Severity:  normal       |   Resolution:             
 Keywords:  has-patch    |  
Comment (by hovenko):

 Replying to [comment:3 markjaquith]:
 > Andy Skelton noted that you can accomplish this without a function, by
 simply manipulating the superglobal "live" in a plugin.

 Manipulating it is not a good solution, far from it. In my world you
 should never manipulate the $_SERVER (and $_REQUEST and such) because that
 might/could/would break functionality in plugins or other 3rd party

 > Furthermore, that gives people the freedom to use HTTP_X_FORWARDED_FOR
 values or not, instead of forcing them to accept them.

 In contrast to the current implementation where WordPress forces users to

 I believe WordPress should default to use HTTP_X_FORWARDED_FOR if it's
 set, to get correct author IP addresses on comments and posts. If someone
 don't want to use it they could override this behaviour by hooking on the
 "remote_ip_address". Overriding $_SERVER['REMOTE_ADDR'] will be just
 another hack to fix a bug.

 If a new function is not wanted, at least a filter should be added and
 applied in those cases where the remote address is used, but that will be
 harder to use and maintain.

Ticket URL: <http://trac.wordpress.org/ticket/4602#comment:5>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list