Last active
July 4, 2017 11:23
-
-
Save nciske/7918515 to your computer and use it in GitHub Desktop.
Add IP to WooCommerce email footer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('woocommerce_email_footer_text','add_ip_to_email_footer', 10, 1); | |
function add_ip_to_email_footer( $footer ){ | |
return $footer . ' IP: ' . getRealIPAddress(); | |
} | |
function getRealIPAddress(){ | |
if (!empty($_SERVER['HTTP_CLIENT_IP'])){ | |
$remote_ip =$_SERVER['HTTP_CLIENT_IP']; | |
}elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){ | |
$remote_ip =$_SERVER['HTTP_X_FORWARDED_FOR']; | |
}else{ | |
$remote_ip =$_SERVER['REMOTE_ADDR']; | |
} | |
return $remote_ip; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OK, this works perfectly. Here's the screenshot:
https://www.evernote.com/shard/s10/sh/00d74c4c-998e-4164-bacd-28565a753ac5/49b2a2486cdec5777cf6fff82ca655aa