最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

customization - How can I delete the word `Category:` from page titles?

programmeradmin1浏览0评论
This question already has answers here: How to customize the_archive_title()? (7 answers) Closed 5 years ago.

If I installed a new WordPress with twentysixteen theme and went to uncategorized page, I will see at the title something like

Category: Uncategorized

how can I remove the category: word from pages titles?

This question already has answers here: How to customize the_archive_title()? (7 answers) Closed 5 years ago.

If I installed a new WordPress with twentysixteen theme and went to uncategorized page, I will see at the title something like

Category: Uncategorized

how can I remove the category: word from pages titles?

Share Improve this question asked May 21, 2019 at 5:49 iLinux85iLinux85 1274 bronze badges 0
Add a comment  | 

1 Answer 1

Reset to default 0

For achieve this title you need to extend get_the_archive_title . here is how or check the official doc

function wpse64458_get_the_archive_title($title){
    if ( is_category() ) {
        $title = single_cat_title( '', false );
    } elseif ( is_tag() ) {
        $title = single_tag_title( '', false );
    }
    return $title;
}
add_filter( 'get_the_archive_title', 'wpse64458_get_the_archive_title');
发布评论

评论列表(0)

  1. 暂无评论