In Wordpress, I have a page template named designers.php.
When loading, it reads slugto obtain the uniqe identifier, and then calls the database to obtain design information.
I want to use this information to change the page name using the name of the designer in the title tag.
I tried using add_filterin my designers.phpfile, but it does not work:
add_filter('wp_title', 'set_page_title');
function set_page_title($title) {
global $brand;
return 'Designer '.$brand['name'].' - '.get_bloginfo('name');
}
I assume that it add_filtershould either be inside the plugin or in a file functions.php.
How can I achieve what I am trying to do?
UPDATE
Function never runs while I use wp_title. If I change it to init(for testing), the function will be launched.
add_filter wp_title?