👋🏼Welcome to my WP-Host blog where I am excited to share my knowledge and expertise on WordPress hosting and website construction tutorials with you. Let’s connect and learn from each other! You can reach me at info@yrshare.com.

(如果你会中文,可以点击微信图标与我联系。)

扫一扫加我

注:因个人英文水平有限,所以暂时只能为懂中文的朋友提供wordpress建站服务

微信:18200592859 或 yrwordpress

Add automatic tag tags to the website (improve SEO optimization effect)

Add automatic tag tags to the website (improve SEO optimization effect)-WP-Host

Add automatic tag tags to the website (improve SEO optimization effect): Continue to share the wordpress website building tutorial. Good use of tag tags is of great help to website SEO optimization. This article will share with you a usage of tag tags. If used well, it can further improve the SEO optimization effect of Google.

【WP-Host/悦然wordpress建站】

Keep sharing wordpress tutorials.

We all know that website SEO optimization is mainly to optimize content, external links, and internal links, and tag tags are very good internal links in wordpress websites.

By default, the tag label of the website will appear at the bottom of the article, but the effect may not be very good if this is the case. The tutorial in this article is to teach you to use tags to make a website internal link, and it is an automatic internal link, which does not require us
Add it manually.

Here’s how to start sharing:

1. Use plugins

Add automatic tag tags to the website (improve SEO optimization effect)-WP-Host

Auto Tag Links

https://wordpress.org/plugins/auto-tag-links/

In fact, the tag internal link is not a high-end function. There are many plug-ins that can realize this function, so it is the simplest and most convenient to use the plug-in to realize the tag internal link, such as Auto Tag Links. After installation, you can set and save it.
convenient.

2. Use the code

Some people may worry that the use of plug-ins will affect the opening speed of the website. Although one or two plug-ins alone do not have a great impact on the opening speed of the website, there are indeed ways to not use plug-ins. Let me share with you a piece of code to realize the internal link of the label:

//Automatically add tags to internal links
$match_num_from = 1; //Indicates that the tag appears at least once to add an automatic internal link
$match_num_to = 1; //Indicates how many internal links can be added to a tag in the article at most, and it is recommended to set it up to 3 times
add_filter('the_content','tag_link',1);
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){
global $match_num_from,$match_num_to;
$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 = "<a href=\"$link\" title=\"".str_replace('%s',addcslashes($cleankeyword, '$'),__('View all posts in %s'))."\"";
$url .= ' target="_blank"';
$url .= ">".addcslashes($cleankeyword, '$')."</a>";
$limit = rand($match_num_from,$match_num_to);
$content = preg_replace( '|(<a[^>]+>)(.*)('.$ex_word.')(.*)(</a[^>]*>)|U'.$case, '$1$2%&&&&&%$4$5', $content);
$content = preg_replace( '|(<img)(.*?)('.$ex_word.')(.*?)(>)|U'.$case, '$1$2%&&&&&%$4$5', $content);
$cleankeyword = preg_quote($cleankeyword,'\'');
$regEx = '\'(?!((<.*?)|(<a.*?)))('. $cleankeyword . ')(?!(([^<>]*?)>)|([^>]*?</a>))\'s' . $case;
$content = preg_replace($regEx,$url,$content,$limit);
$content = str_replace( '%&&&&&%', stripslashes($ex_word), $content);
}
}
return $content;
}

Add the above code to the functions.php of the current wordpress theme and save it, then refresh the website to see the effect.

The implementation method of the automatic label internal link shared in this article is not suitable for all websites. You need to choose whether to use it according to the situation. For example, your website has little content, not many labels, and there are few contents under the same label, so 【WP-Host/悦然wordpress建站】 It is not recommended that you use the automatic label internal link function. At the same time, the content quality of the website is also very important. It is useless to add more label internal links to poor quality content.

The automatic label internal link function is more suitable for websites with a lot of content, because too much content is not suitable for manually adding internal links, and the efficiency is too low.
If your website does not have much content, my suggestion is to add internal links manually, and label internal links are not the best internal links. The best internal links are to add relevant internal links according to the content of the article, such as
Can link to an article.

Summarize

Whether it is wordpress site building or SEO optimization, content is still the key.
The automatic label internal link can play an icing on the cake effect, but the most important thing is to do a good job in the content foundation.

继续分享wordpress建站教程。

我们都知道网站SEO优化主要是做内容、外链、内链的优化,而tag标签就是wordpress网站中非常好的内链。默认情况下网站的tag标签会出现在文章底部,但是光是这样的话效果可能不是太好,所在本文的教程是教大家通过标签来做好网站内链,而且是自动内链,并不需要我们手动去添加。

下面开始分享方法:

一、使用插件

Add automatic tag tags to the website (improve SEO optimization effect)-WP-Host

Auto Tag Links

https://wordpress.org/plugins/auto-tag-links/

其实标签内链并不是什么高大上的功能,这种功能有很多插件都可以实现,所以使用插件来实现标签内链是最简单方便的,比如Auto Tag Links,安装之后设置保存就可以了,很方便。

二、使用代码

可能有人会担心使用插件会影响网站打开速度,虽然单独一两个插件对网站打开速度的影响并不大,但也确实有不使用插件的方法,下面就给大家分享一段实现标签内链的代码:

//自动添加tag标签内容 悦然wordpress建站收集整理
$match_num_from = 1; //表示标签最少出现一次才会添加自动内链
$match_num_to = 1; //表示文章中一个标签最多添加几1次内链,建议最多设为3次
add_filter('the_content','tag_link',1);
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){
global $match_num_from,$match_num_to;
$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 = "<a href=\"$link\" title=\"".str_replace('%s',addcslashes($cleankeyword, '$'),__('View all posts in %s'))."\"";
$url .= ' target="_blank"';
$url .= ">".addcslashes($cleankeyword, '$')."</a>";
$limit = rand($match_num_from,$match_num_to);
$content = preg_replace( '|(<a[^>]+>)(.*)('.$ex_word.')(.*)(</a[^>]*>)|U'.$case, '$1$2%&&&&&%$4$5', $content);
$content = preg_replace( '|(<img)(.*?)('.$ex_word.')(.*?)(>)|U'.$case, '$1$2%&&&&&%$4$5', $content);
$cleankeyword = preg_quote($cleankeyword,'\'');
$regEx = '\'(?!((<.*?)|(<a.*?)))('. $cleankeyword . ')(?!(([^<>]*?)>)|([^>]*?</a>))\'s' . $case;
$content = preg_replace($regEx,$url,$content,$limit);
$content = str_replace( '%&&&&&%', stripslashes($ex_word), $content);
}
}
return $content;
}

把上面的代码添加到当前wordpress主题的functions.php中保存,然后刷新网站就可以看到效果了。

三、标签内链注意事项

本文分享的自动标签内链实现方法并不适合所有的网站,需要根据情况选择是否使用,比如你的网站内容很少,标签也不多,而且相同标签下的内容也很少,那么【WP-Host/悦然wordpress建站】就不建议你使用自动标签内链功能,同时网站的内容质量也很重要,质量差的内容做再多标签内链也没用。

自动标签内链功能比较适合内容较多的网站,因为内容太多就不太适合手动添加内链,效率太低。如果你的网站内容并不多,我的建议还是手动添加内链更好一些,而且标签内链也并不是最好的内链,最好的内链就是根据文章内容添加相关的内链,比如可以链接到某一篇文章。

总结

不管是wordpress建站还是SEO优化,内容仍然是关键。自动标签内链可以起到锦上添花的效果,但做好内容基础才是最重要的。

WordPress Hosting / 悦然wordpress建站

WordPress Hosting / 悦然wordpress建站

【WordPress Hosting / 悦然wordpress建站】I am a WordPress hobby from China, and I like to communicate with friends from all over the world to learn WordPress website building and maintenance related knowledge.