It sounds like you’re trying to modify document’s <title>
tag as opposed to the post titles typically wrapped in <h1>
/<h2>
tags, which you’ve already accomplished.
If the theme you’re using implements titles in the WordPress 4.4+ manner, you can use the document_title_parts
filter:
/**
* document_title_parts
*
* Filters the parts of the document title.
*
* @since 4.4.0
*
* @param array $title {
* The document title parts.
*
* @type string $title Title of the viewed page.
* @type string $page Optional. Page number if paginated.
* @type string $tagline Optional. Site description when on home page.
* @type string $site Optional. Site title when not on home page.
* }
*/
add_filter( 'document_title_parts', 'wpse241607_document_title_parts', 10, 1 );
function wpse241607_document_title_parts( $title ) {
$title['title'] = '##### ' . $title['title'] . ' #####';
return $title;
}
For Yoast SEO, you can check out the wpseo_title
filter, which is used to filter the title text.