Issues with title-tag and document_title_parts
I ran your filter in my development area. It didn’t work. Then I switched off the Yoast SEO plugin, which I knew was also messing with the page title. Then it worked. So my suggestion would be another plugin is messing with it. In the case of Yoast, it was a filter call to pre_get_document_title … Read more