We store the data for the user profiles on our site in a mongodb and provide them via a REST API. So i added a page template page-profile.php. In that file we call the REST API and fill the template with the responding data. We added rewrite_rules to the functions.php, so the profile template knows which profile fetch from the REST API.
add_rewrite_rule('^termin/([^/]*)/([^/]*)/([^/]*)$', 'index.php?pagename=profile&location=$matches&industry=$matches&slug=$matches', 'top');
$slug = $location = htmlspecialchars(urldecode(get_query_var('slug'))); $office = $dataAccess->getProfile($slug);
That all works fine, we use the
$slug to get the correct data from the REST API and store them in the
$office->name describe the name of the profile. My question is: How can i use the
$office->name in the page title (needed for better SEO)?
I know I can use the the wordpress filter
wp_title to set the title dynamically in the functions.php. But how I can use the
$office->name (page-profile.php) in the
wp_title filter (functions.php)?