Skip to content

Instantly share code, notes, and snippets.

@mclanecreative
Forked from nciske/add_ip_to_wc_email.php
Last active December 31, 2015 02:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mclanecreative/7921988 to your computer and use it in GitHub Desktop.
Save mclanecreative/7921988 to your computer and use it in GitHub Desktop.
add_filter('woocommerce_email_footer_text','add_ip_to_email_footer', 10, 1);
function add_ip_to_email_footer( $footer ){
return $footer . ' | User 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