WordPress网站中如何防止机器人扫描电子邮箱

前端之家收集整理的这篇文章主要介绍了WordPress网站中如何防止机器人扫描电子邮箱前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

站长朋友们都了解,现在网络上有非常多的爬虫,四处搜集网站代码中出现的电子邮箱,搜集到了之后就批量出售或者给站长发送垃圾邮件

很多人习惯把邮箱中的 “@” 换成 “#”,但这样对用户不太方便,而且这种方法很多机器人都可以识破了,电子邮箱同样被搜集走。

这篇wordpress教程里,我们就向大家介绍如何通过编码邮箱的方式防止机器人扫描电子邮箱。

切换到主题目录,打开 functions.PHP 文件,加入以下代码

Crayon-5c891cdc5e713137812438" class="Crayon-Syntax Crayon-theme-classic Crayon-font-monaco Crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouSEOver" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
Crayon-toolbar" data-settings=" mouSEOver overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">Crayon-title">functions.PHP
Crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
Crayon-button Crayon-nums-button" title="Toggle Line Numbers">
Crayon-button-icon">
Crayon-button Crayon-plain-button" title="Toggle Plain Code">
Crayon-button-icon">
Crayon-button Crayon-wrap-button" title="Toggle Line Wrap">
Crayon-button-icon">
Crayon-button Crayon-expand-button" title="Expand Code">
Crayon-button-icon">
Crayon-button Crayon-copy-button" title="Copy">
Crayon-button-icon">
Crayon-button Crayon-popup-button" title="Open Code In New Window">
Crayon-button-icon">
Crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
Crayon-plain-wrap">
Crayon-main" style="">Crayon-table">Crayon-row">
Crayon-nums " data-settings="show">
Crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
Crayon-num" data-line="Crayon-5c891cdc5e713137812438-1">1
Crayon-num Crayon-striped-num" data-line="Crayon-5c891cdc5e713137812438-2">2
Crayon-num" data-line="Crayon-5c891cdc5e713137812438-3">3
Crayon-num Crayon-striped-num" data-line="Crayon-5c891cdc5e713137812438-4">4
Crayon-code">
Crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
Crayon-line" id="Crayon-5c891cdc5e713137812438-1">Crayon-t">functionCrayon-h"> Crayon-e">wp_antispambotCrayon-sy">(Crayon-h"> Crayon-sy">$Crayon-v">attrCrayon-sy">,Crayon-h"> Crayon-sy">$Crayon-i">contentCrayon-h"> Crayon-sy">)Crayon-sy">{
Crayon-line Crayon-striped-line" id="Crayon-5c891cdc5e713137812438-2">Crayon-h">Crayon-st">returnCrayon-h"> Crayon-e">antispambotCrayon-sy">(Crayon-h"> Crayon-sy">$Crayon-i">contentCrayon-h"> Crayon-sy">)Crayon-sy">;
Crayon-line" id="Crayon-5c891cdc5e713137812438-3">Crayon-sy">}
Crayon-line Crayon-striped-line" id="Crayon-5c891cdc5e713137812438-4">Crayon-e">add_shortcodeCrayon-sy">(Crayon-h"> Crayon-s">'email'Crayon-sy">,Crayon-h"> Crayon-s">'wp_antispambot'Crayon-h"> Crayon-sy">)Crayon-sy">;

文章中需要插入邮箱的地方,按照如下短代码格式书写:

Crayon-5c891cdc5e71b556179045" class="Crayon-Syntax Crayon-theme-classic Crayon-font-monaco Crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouSEOver" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
Crayon-toolbar" data-settings=" mouSEOver overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">Crayon-title">
Crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
Crayon-button Crayon-nums-button" title="Toggle Line Numbers">
Crayon-button-icon">
Crayon-button Crayon-plain-button" title="Toggle Plain Code">
Crayon-button-icon">
Crayon-button Crayon-wrap-button" title="Toggle Line Wrap">
Crayon-button-icon">
Crayon-button Crayon-expand-button" title="Expand Code">
Crayon-button-icon">
Crayon-button Crayon-copy-button" title="Copy">
Crayon-button-icon">
Crayon-button Crayon-popup-button" title="Open Code In New Window">
Crayon-button-icon">
Crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
Crayon-plain-wrap">
Crayon-main" style="">Crayon-table">Crayon-row">
Crayon-nums " data-settings="show">
Crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
Crayon-num" data-line="Crayon-5c891cdc5e71b556179045-1">1
Crayon-code">
Crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
Crayon-line" id="Crayon-5c891cdc5e71b556179045-1">Crayon-sy">[Crayon-v">emailCrayon-sy">]电子邮箱Crayon-sy">[Crayon-o">/Crayon-v">emailCrayon-sy">]

这样一来,访问者在前台看到的邮箱是正常的,然而源代码里却是一堆转义的字符。

原文链接:https://www.f2er.com/wordpress/238395.html

猜你在找的wordpress相关文章