[WordPress] リバースプロキシ使ってる時のコメントユーザーIP対策

//  applied to the comment author's IP address prior to saving the comment in the database. 
function auto_reverse_proxy_pre_comment_user_ip() {    
	if ( isset($_SERVER['X_FORWARDED_FOR']) && !empty($_SERVER['X_FORWARDED_FOR']) ) {
		$X_FORWARDED_FOR = (array)explode(",", $_SERVER['X_FORWARDED_FOR']);
		$REMOTE_ADDR = trim($X_FORWARDED_FOR[0]); //take the last 
	} else {
		$REMOTE_ADDR = $_SERVER['REMOTE_ADDR'];
	}
	return $REMOTE_ADDR;
}
add_filter ( 'pre_comment_user_ip','auto_reverse_proxy_pre_comment_user_ip' );

via. Plugin API/Filter Reference/pre comment user ip « WordPress Codex