标签存档页面上的 Wordpress 标签问题 [英] Wordpress Tag issue on tag archive page

查看:34
本文介绍了标签存档页面上的 Wordpress 标签问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从 category.php 页面,我点击 tag 并转到 tag.php 页面.

From category.php Page I click on tag and it goes to tag.php page.

以下代码返回存档/标签页上的标签.

The following code returns the tag on archive/tag page.

但我在它之前添加了一个词标签:".

But i adds a word "Tag:" before it.

标签:标签名

如何删除标签:"并仅显示标签名称?

How can I remove that "Tag:" and show only tag name ?

推荐答案

你可以试试这个:

add_filter( 'get_the_archive_title', function ($title) {

    if( is_tag() ) {

        $title = single_tag_title( '', false );

    }

    return $title;

});

您应该将其粘贴到您的主题 functions.php 文件中.

You should paste it in your theme functions.php file.

干杯!

这篇关于标签存档页面上的 Wordpress 标签问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆