Last update at :2024-02-15,Edit by888u
In fact, many friends are using this function, which is to change the external link to the URL/go/external link mode of their own blog. Many friends say that direct external links in the blog will affect the weight of the website. This is also possible. , it’s useless for bloggers anyway, so I’ll just share with you how to change it.
Open the functions.php file of the current wordpress theme, or WP backend appearance-edit-functions.php. Of course, some themes are redirected to other files. You can find it yourself and add the following code:
//Add go jump to the internal and external links of the article function the_content_nofollow($content){ preg_match_all('//',$content,$matches); if($matches){ foreach($matches[2] as $val){ if(strpos($val,'://')!==false && strpos($val,home_url())===false && !preg_match('/\.(jpg|jepg|png|ico|bmp| gif|tiff)/i',$val)){ $content=str_replace("href=\"$val\"", "href=\"".home_url()."/go/?url=$val\" ",$content); } } } return $content; } add_filter('the_content','the_content_nofollow',999);Create the folder go in the root directory of the blog file, upload the index.php file in the attachment below, and modify the internal URL to be yours.
Download address: https://www.lanzous.com/i2jx3sf
Recommended site search: free website domain name registration, icp filing website, overseas server, US server defense, free domain name, filing system, mainland China site group server, Hong Kong host high defense, free static space, telecommunications server,
发表评论