这个和外链转内链的方法大同小异——都是利用函数钩子添加替换动作,将href属性替换为带有nofollow属性的形式。外链转内链的教程在本站这里
代码如下:

// 文章外链转内链并转入跳转页面
add_filter('the_content','goto_url',999);
function goto_url($content){
    preg_match_all('/rel="nofollow" target="_blank" href="(.*?)"/',$content,$matches);
    if($matches){
        foreach($matches[1] as $val){
            if( strpos($val,home_url())===false&&strpos($val,"javascript:void(0)")===false )
                $content=str_replace("href=\"$val\"", "rel=\"nofollow\" target=\"_blank\" href=\"$val\"",$content);
        }
    }
    return $content;
}

只不过改了一句代码而已。That's all.