Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/267.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用Wordpress中的添加过滤器将链接更改为nofollow_Php_Wordpress - Fatal编程技术网

Php 使用Wordpress中的添加过滤器将链接更改为nofollow

Php 使用Wordpress中的添加过滤器将链接更改为nofollow,php,wordpress,Php,Wordpress,我正在尝试将nofollow添加到活动日历中的场馆链接中。请参阅示例页 下面是我正在使用的函数。当我把它放在functions.php中时,我得到了一个错误 我将感谢任何提示和帮助如何解决这个问题 add_filter('tribe_get_event_website_link', 'ip_nofollow_link', 10, 2); function ip_nofollow_link($html) { return str_replace('<a href="%s" target=

我正在尝试将nofollow添加到活动日历中的场馆链接中。请参阅示例页

下面是我正在使用的函数。当我把它放在functions.php中时,我得到了一个错误

我将感谢任何提示和帮助如何解决这个问题

add_filter('tribe_get_event_website_link', 'ip_nofollow_link', 10, 2);

function ip_nofollow_link($html)  {
return str_replace('<a href="%s" target="%s">%s</a>,' '<a href="%s" target="%s">%s</a> rel="nofollow"', $html);
}
add_filter('tribe_get_event_web_link','ip_nofollow_link',10,2);
函数ip_nofollow_链接($html){
返回str_replace(','rel=“nofollow”',$html);
}

由于您的站点已经使用SEO Yoast,我建议您使用该功能添加nofollow选项。它将比通过函数来处理更安全。这是一个网页搜索引擎优化不是一个功能

这里是所有的解释

•如果您正在链接以将价值传递给用户,那么您可以继续保持链接。 •如果你链接到一个与你的原始站点基本无关的站点,你可能不应该点击链接。 •如果你链接的SEO价值高于你的用户价值,不要。不跟随链接或根本不链接。 •如果您的链接达到了将50多个站点连接在一起的水平,那么即使它们传递了用户价值,也不要跟随您的链接

也检查