Change separators in HTML tags

I’m using WP 4.7.3 and a custom template set (mh-magazine).

By default, WP sets a title tag like “Page title” – “Blog title”.

Now all I want to achieve is to replace “-” into a pipe symbol for layout reasons. So the processed HTMl should look like:

My page title | My blog title

I thought that this is easy to achieve, but I see I need some help since I’m not an expert in PHP or WP.

4 Answers
4

It all depends on how your theme’s header.php is structured, but the most likely way is via the document_title_separator filter, as in

add_filter ('document_title_separator', 'wpse_set_document_title_separator') ;

function
wpse_set_document_title_separator ($sep)
{
    return ('|') ;
}

Leave a Comment