Do you have any SEO plugins installed? They usually fiddle with this logic. Having Yoast enabled, the pre_get_document_title
does not work for me, instead you should use wpseo_title
per their documentation.
Having said that, with SEO plugins disabled and add_theme_support('title-tag');
enabled, the pre_get_document_title
filter works for me without any problem.
add_action('after_setup_theme', function () {
add_theme_support('title-tag');
}, 20);
add_filter('pre_get_document_title', function ($title) {
return 'ORO!';
});
Result is, that I see ORO!
as the page title.