{"id":129,"date":"2017-10-17T07:51:08","date_gmt":"2017-10-17T07:51:08","guid":{"rendered":"https:\/\/wpinvoicing.com\/docs\/?p=129"},"modified":"2019-11-16T10:25:06","modified_gmt":"2019-11-16T10:25:06","slug":"wpinv_get_ip","status":"publish","type":"docs","link":"https:\/\/wpgetpaid.com\/docs\/developers\/wpinv_get_ip\/","title":{"rendered":"wpinv_get_ip"},"content":{"rendered":"<p>Filters the IP address of the current visitor.<\/p>\n<p><pre><code>apply_filters( 'wpinv_get_ip', string $ip );<\/code><\/pre>\n<\/p>\n<p class=\"clearfix\">\n<h4 id=\"parameters\">Parameters <a href=\"#parameters\" class=\"anchor\"><span aria-hidden=\"true\">#<\/span><\/a><\/h4>\n<h4 id=\"parameters\">Returns <a href=\"#returns\" class=\"anchor\"><span aria-hidden=\"true\">#<\/span><\/a><\/h4>\n<dl>\n<dt>$ip<\/dt>\n<dd>\n<p class=\"desc\"><span class=\"type\">(<span class=\"object\">string<\/span>) <\/span><span class=\"description\">Current visitor&#8217;s IP address.<\/span><\/p>\n<\/dd>\n<\/dl>\n<h4 id=\"examples\">Examples <a href=\"#examples\" class=\"anchor\"><span aria-hidden=\"true\">#<\/span><\/a><\/h4>\n<p>Set the current visitor&#8217;s IP address from United Kingdom IP address range. It will identify that the current visitor is from United Kingdom.<\/p>\n<pre>function _wpi_wpinv_get_ip( $ip ) {\r\n    \/*\r\n     * Sample IP addresses for different countries.\r\n     * \r\n     * 90.222.150.124    =>    Glasgow, Scotland, United Kingdom (GB)\r\n     * 79.150.150.150    =>    Barcelona, Catalonia, Spain (ES)\r\n     * 106.209.216.208   =>    Mumbai, Maharashtra, India (IN)\r\n     * 220.240.220.240   =>    Sydney, New South Wales, Australia (AU)\r\n     *\/\r\n    $ip = '90.222.150.124';\r\n    \r\n    return $ip;\r\n}\r\nadd_filter( 'wpinv_get_ip', '_wpi_wpinv_get_ip', 10, 1 );<\/pre>\n","protected":false},"featured_media":0,"parent":241,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","doc_tag":[],"amp_validity":null,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/wpgetpaid.com\/docs\/wp-json\/wp\/v2\/docs\/129"}],"collection":[{"href":"https:\/\/wpgetpaid.com\/docs\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/wpgetpaid.com\/docs\/wp-json\/wp\/v2\/types\/docs"}],"replies":[{"embeddable":true,"href":"https:\/\/wpgetpaid.com\/docs\/wp-json\/wp\/v2\/comments?post=129"}],"version-history":[{"count":0,"href":"https:\/\/wpgetpaid.com\/docs\/wp-json\/wp\/v2\/docs\/129\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/wpgetpaid.com\/docs\/wp-json\/wp\/v2\/docs\/241"}],"wp:attachment":[{"href":"https:\/\/wpgetpaid.com\/docs\/wp-json\/wp\/v2\/media?parent=129"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/wpgetpaid.com\/docs\/wp-json\/wp\/v2\/doc_tag?post=129"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}