How to change the seperator in the title


Change title separator.

I’m working with the underscores starter theme. I want to make a small change to the title. Change the separator from
“Post title | site name” to “Post title – site name”

The simple way of doing this was to put

 <title><?php wp_title('-', true, 'right' ); ?><?php bloginfo( 'name' ); ?></title>

in the header.
But now I read that with the introduction of add_theme_support( 'title-tag' ); one should not use the <title> markup in the header.

So is there a simple way to change the separator in the title?

Why this question is different from other similar questions:
This is really about best practice, since the introduction of add_theme_support( 'title-tag' ); and how to use and modify it, since we are no longer supposed to use the <title> tag in the header.

[ I really hope that I don’t have to write 8 lines of code to make such a small change.
If I decide to finally use the <title> tag as a more straightforward solution, should I comment out/remove the add_theme_support( 'title-tag' ); from functions.php? ]

IXN 7 months 0 Answers 93 views 0

Leave an answer