Custom Title for the Homepage
Sets the browser and search result title of the homepage to the exact text you choose instead of "Site Name - Tagline".
Opens WPIDE on
Code
// Full title used on the homepage.
$wpide_homepage_title = 'Acme Studio | Web Design and Branding in Lisbon';
add_filter( 'pre_get_document_title', function ( $title ) use ( $wpide_homepage_title ) {
if ( is_front_page() && '' !== trim( $wpide_homepage_title ) ) {
return $wpide_homepage_title;
}
return $title;
} );
Notes
Skip this if an SEO plugin already manages your homepage title.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.