I am trying to overwrite the <title>
tag of a page using a Wordpress plugin.
I don't want to change the theme's code. I just wanna force the theme to change some page titles via the plugin.
The theme uses add_theme_support( 'title-tag' )
. Note that the use of wp_title is now deprecated.
Your problem is that you can not use
wp_title()
in the theme if the theme already supportstitle-tag
. The<head>
of your theme should look like this:The filter and
title-tag
support:If you do this, it will work perfectly.