
北瓜君 
0 感谢前来看看2年前湖北

redeyes 
0 感谢老大分享2年前重庆

梦楠 
0 谢谢分享2年前上海

初晨-ccyuanma.com 
0 //WordPress文章关键词自动内链 大白博客 function tag_sort($a, $b){ if ( $a->name == $b->name ) return 0; return ( strlen($a->name) > strlen($b->name) ) ? -1 : 1; } function tag_link($content){ $match_num_from = 1; //一个标签少于几次不链接 $match_num_to = 1; //一个标签最多链接几次 $posttags = get_the_tags(); if ($posttags) { usort($posttags, "tag_sort"); foreach($posttags as $tag) { $link = get_tag_link($tag->term_id); $keyword = $tag->name; //链接代码 $cleankeyword = stripslashes($keyword); $url = "".addcslashes($cleankeyword, '$').""; $limit = rand($match_num_from,$match_num_to); //不链接代码 $content = preg_replace( '|(]+>)(.*)('.$ex_word.')(.*)(]*>)|U'.$case, '$1$2%&&&&&%$4$5', $content); $content = preg_replace( '|()|U'.$case, '$1$2%&&&&&%$4$5', $content); $cleankeyword = preg_quote($cleankeyword,'\''); $regEx = '\'(?!((<.*?)|(<a.*?)))('. $cleankeyword . ')(?!(([^]*?)>)|([^>]*?))\'s' . $case; $content = preg_replace($regEx,$url,$content,$limit); $content = str_replace( '%&&&&&%', stripslashes($ex_word), $content); } } return $content; } add_filter('the_content','tag_link',1);2年前

番茄坤 
0 谢谢分享2年前广东

qinxi1 
0 谢谢分享2年前湖南

xc349512 
0 感谢
2年前山东

dahui 
0 看看能不能用2年前湖北

亚布 
0 是官方的吗2年前河南

鼠子
作者0 是官方的2年前山东@亚布

易晴 
0 感谢楼主分享2年前浙江
回复218
只看作者最新最热
加载更多








![表情[ciya]-WordPress主题模板-zibll子比主题](https://www.zibll.com/wp-content/themes/zibll/img/smilies/ciya.gif)


