SEO Ultimate 真的是一个非常强大的 WordPress SEO 插件,它可以帮助我们很好的优化我们的 WordPress 博客。而且它与All in One SEO Pack可以很好的兼容,这样你可以轻松地导入All in One SEO Pack元数据,从而切换到SEO Ultimate。
SEO Ultimate插件中的Deeplink Juggernaut深层链接这个模块允许我们设置一些关健词,当您的文章中有与后台设置好的关健词相同时,则会在文章中生成内部链接.这个模块默认是不支持中文关键词的,通过以下的设置可以支持中文的自动加链接功能。
打开:/wp-content/plugins/seo-ultimate/includes/jlfunctions/str.php
找到:
static function htmlsafe_preg_replace($search, $replace, $subject, $limit, &$count, $exclude_tags = false) {
if (!$exclude_tags || !is_array($exclude_tags)) $exclude_tags = array(‘a’, ‘pre’, ‘code’, ‘kbd’);
if (count($exclude_tags) > 1)
$exclude_tags = sustr::preg_filter(‘a-z0-9|’, implode(‘|’, $exclude_tags));
else
$exclude_tags = array_shift($exclude_tags);$search = str_replace(‘/’, ‘\/’, $search);
//Based off of regex from
//https://stackoverflow.com/questions/3013164/regex-to-replace-a-string-in-html-but-not-within-a-link-or-heading
$search_regex = “/($search)(?!(?:(?!<\/?(?:$exclude_tags).*?>).)*<\/(?:$exclude_tags).*?>)(?![^<>]*>)/imsU”;return preg_replace($search_regex, $replace, $subject, $limit, $count);
}
其中的正则修改为:
$search_regex
=
"/($search)(?!(?:(?!<\/?(?:$exclude_tags).*?>).)*<\/(?:$exclude_tags).*?>)(?![^<>]*>)/imsU"
;
删除”\b”就可以正常过滤汉字了。