In the past, many posts on the site were extracted from external articles. many links in the article either failed for a long time or some testing websites, such as http: // localhost/and so on. If there are too many links, many dead links will be formed in the site, which is very unfavorable for SEO optimization. Therefore, you need to filter the content in the site and add the link that is not an internal link with the rel = "nofollow" attribute.
Find the function for filtering external links of wordpress on the Internet, and change it to use it.
// Add nofllow $ content $ domain the current website domain name function content_nofollow ($ content, $ domain) {preg_match_all ('/href = "(.*?) "/', $ Content, $ matches); if ($ matches) {foreach ($ matches [1] as $ val) {if (strpos ($ val, $ domain) === false) $ content = str_replace ('href = "'. $ val. '"', 'href = "'. $ val. '"rel =" external nofollow "', $ content) ;}} preg_match_all ('/src = "(. *?) "/', $ Content, $ matches); if ($ matches) {foreach ($ matches [1] as $ val) {if (strpos ($ val, $ domain) === false) $ content = str_replace ('src = "'. $ val. '"', 'src = "'. $ val. '"rel =" external nofollow "', $ content) ;}}return $ content;} is well called during the call, the following is a demo call: $ a ['content'] = content_nofollow ($ a ['content'], $ domain); // Add the nofllow attribute to the link in the article content! The domain name needs to be filtered without "/", such as http://www.ledaokj.com so that good filtering. Original article link: adds filtering of external links to site content