Title: Plugin returns same geo data anywhere
Last modified: September 15, 2020

---

# Plugin returns same geo data anywhere

 *  Resolved [Kim](https://wordpress.org/support/users/spacewell/)
 * (@spacewell)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/plugin-returns-same-geo-data-anywhere/)
 * I’m trying to build some scripts showing a user the time of an online event according
   to the timezone he is in.
 * It seems geoip_detect2_get_info_from_current_ip() is returning the same data 
   no matter where the user is. I tested using VPN, Geoscreenshot.com and asked 
   colleague in India and the US. The date retuned is the same everywhere.
 * I was assuming it was caused by caching but turning off the caching plugin (WP
   Rocket) completely does not seem to solve the issue.
    -  This topic was modified 5 years, 8 months ago by [Kim](https://wordpress.org/support/users/spacewell/).

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [Kim](https://wordpress.org/support/users/spacewell/)
 * (@spacewell)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/plugin-returns-same-geo-data-anywhere/#post-13408614)
 * At first I used the function like this:
    `$userInfo = geoip_detect2_get_info_from_current_ip();`
 * But then I found t should probably be:
 *     ```
       $ip = geoip_detect2_get_client_ip();	
       $userInfo = geoip_detect2_get_info_from_current_ip($ip);
       ```
   
 * Echoing out geoip_detect2_get_client_ip() now shows the same IP address everywhere.
 * This is what the Client IP Debug Panel shows:
 * > Current IP informations (as detected by the plugin)
   >  Detected client IP: 10.10.4.252
   > This IP is used for detecting the geo-information of the user. It should be
   > the same as the real client IP below. Real client IP (detected without the 
   > plugin): Failed: error This IP is detected within the browser, so reverse proxies
   > of the server are not affected. External Server IP: 81.246.42.197 In some cases,
   > the server is in the same network as the client (e.g. testing server). As the
   > connection does not use Internet, this plugin uses the IP adress of the server
   > as seen from the internet. For performance reasons, this IP is cached for 2
   > hours. Also, for servers without internet access, this IP can be set in the
   > options. REMOTE_ADDR: 10.10.4.252 In server configurations without reverse 
   > proxy, this will equal to the “detected client IP”. Otherwise, this is the 
   > IP of the reverse proxy. HTTP_X_FORWARDED_FOR: (unset) Reverse proxies usually
   > add this header to indicate the original IP. If several IPs are given here (
   > seperated by a comma), the correct user IP usually is the leftmost one. Settings
   > of the plugin Use reverse proxy: no Enable this option if REMOTE_ADDR is not
   > the correct client IP. Whitelist for known reverse proxies (optional if only
   > one): (none) All IPs in HTTP_X_FORWARDED_FOR that are not the correct client
   > IP are probably known reverse proxies. (For security reasons, this is not assumed
   > by default: maybe the reverse proxy is not of the server, but a Man-In-The-
   > Middle-Attack … not very probable but possible.)
 * What am I missing here?
    -  This reply was modified 5 years, 8 months ago by [Kim](https://wordpress.org/support/users/spacewell/).
    -  This reply was modified 5 years, 8 months ago by [Kim](https://wordpress.org/support/users/spacewell/).
 *  [Benjamin Pick](https://wordpress.org/support/users/benjamin4/)
 * (@benjamin4)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/plugin-returns-same-geo-data-anywhere/#post-13408813)
 * geoip_detect2_get_info_from_current_ip() is equivalent to the other lines you
   mentioned.
 * 10.10.4.252 is a private IP which does not have geolocation information attached,
   so the plugin will get the geoinformation from the server IP (81.246.42.197) 
   instead.
 * If local time is the only reason you are using the plugin, it would be much more
   useful & more exact to use the JavaScript time functions instead of the plugin–
   as some users might have set their computer to use a different timezone than 
   the one detected by IP (e.g. tourists or in case the IP has no geolocation data
   attached), and this is known by the browser, but not the server. For example:
 * [https://stackoverflow.com/questions/6525538/convert-utc-date-time-to-local-date-time?lq=1](https://stackoverflow.com/questions/6525538/convert-utc-date-time-to-local-date-time?lq=1)
 *  Thread Starter [Kim](https://wordpress.org/support/users/spacewell/)
 * (@spacewell)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/plugin-returns-same-geo-data-anywhere/#post-13409220)
 * Thanks very much Benjamin.
 * Auch, I was going at it completely wrong. Thanks for the tip!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Plugin returns same geo data anywhere’ is closed to new replies.

 * ![](https://ps.w.org/geoip-detect/assets/icon-256x256.jpg?rev=978998)
 * [Geolocation IP Detection](https://wordpress.org/plugins/geoip-detect/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/geoip-detect/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/geoip-detect/)
 * [Active Topics](https://wordpress.org/support/plugin/geoip-detect/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/geoip-detect/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/geoip-detect/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Kim](https://wordpress.org/support/users/spacewell/)
 * Last activity: [5 years, 8 months ago](https://wordpress.org/support/topic/plugin-returns-same-geo-data-anywhere/#post-13409220)
 * Status: resolved