Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Replaces invalid IP addresses, or IPv6 addresses, with a valid IPv4
- * address.
- *
- * @param string visitor_ip The original IP address of the visitor.
- * @return string A valid IPv4 address.
- * @author Aelia <support@aelia.co>
- * @link https://aelia.co
- */
- add_filter('wc_aelia_visitor_ip', function($visitor_ip) {
- if(filter_var($ip_address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) === false) {
- // IP Address is not an IPv4. In this case, override it with a default IP
- // address
- // Change the IP to the appropriate one
- $visitor_ip = '249.178.22.114';
- }
- return $visitor_ip;
- }, 10, 1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement