categories - Add specific word before the category page title

in my site category page (archive page), the page title in browser is like this:My site | Site Description | Category ti

in my site category page (archive page), the page title in browser is like this:

My site | Site Description | Category title

How i can add specific word befor all of category title. like:

My site | Site Description | My word Category title

in my site category page (archive page), the page title in browser is like this:

My site | Site Description | Category title

How i can add specific word befor all of category title. like:

My site | Site Description | My word Category title

Share Improve this question asked Apr 8, 2019 at 6:11 mirazizmiraziz 11 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 1

Since WP 4.4 you can change document title using document_title_parts filter hook, in earlier versions it will be wp_title_parts (since v4.0) or wp_title filter.

add_filter( 'document_title_parts', 'se333744_site_title' );
function se333744_site_title( $title )
{
    if ( isset($title['title']) && strlen($title['title']) && !is_front_page() && is_archive() )
        $title['title'] = ' {some prefix} ' . $title['title'];
    return $title;
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745616672a4636277.html

相关推荐

  • categories - Add specific word before the category page title

    in my site category page (archive page), the page title in browser is like this:My site | Site Description | Category ti

    7小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信