This is most likely due to difference in your theme’s support. Some themes render the title by using the wp_title
filter, some by using pre_get_document_title
. If your theme has this line in its functions.php
file:
add_theme_support('title-tag');
Then you need to use the pre_get_document_title
filter, as follows:
add_filter('pre_get_document_title', 'my_title');
function my_title() {
return 'Some title';
}
This is for the newer versions of WordPress. The old installations might be still using the legacy wp_title()
function, which you already mentioned in your question.