Normally the <title> is: “page title » website title”. Makes sense for all pages except for the website front page. For the frontpage it would be better if it was vice versa, that is: “website title » page title”. So this would make it “company name » description” (instead of “description » company name”) which is better for SEO and better for tabs in the browser (which list the title).
How could I change this using a child theme? I searched the forum and found two filters: ‘wp_title’ and ‘kadence_title’. So I am not sure which one to use. On the web I also saw notices that wp_title is deprecated but than reinstated (*Login to see link So I am a bit puzzled. and what works best in Virtue Premium.
add_filter( 'wp_title', 'wpdocs_hack_wp_title_for_home', 10, 2 );
function wpdocs_hack_wp_title_for_home( $title, $sep ) {
if ( is_home() || is_front_page() ) {
$title = get_bloginfo( 'name', 'display' ) . $sep . get_bloginfo( 'description', 'display' );
}
return $title;
}
What’s the best (future safe) way of doing it?