图片|云上悦动

WordPress获取评论用户的IP属地

前言

获取评论用户IP属地依赖wordpress保存的ip地址,然后利用接口获取该用户所在地区!非常简单,看看效果图!

效果图

image

操作步骤

将下方代码添加到functions.php文件里(/zibll/functions.php)

 

这里需要到zib-comments-list.php修改(在zibll/inc/functions),先搜索$replyText_html跳到第二个,然后粘贴下方的代码覆盖它即可!

$user_ip = $comment->comment_author_IP;
$replyText_html = '<span class="reply-link">' . $replyText . '</span><span style="cursor:pointer" data-toggle="tooltip" alt="IP:'.$user_ip.'" data-original-title="IP地址:'.xypro_user_ip($user_ip).'">'.xypro_user_ip($user_ip).'</span>';
© 版权声明
THE END
喜欢就支持一下吧
点赞1投币 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容