WordPress Title Empty on Index Page


WordPress - the logoHere’s description from WordPress Codex about what happen when WordPress title empty when viewing index page/ homepage

If you are using a custom homepage with custom loops and stuff or a custom front-page, you will have an empty wp_title.

I recently encountered this problem on a client’s site. Homepage/Index page is using a static page (WP Dashboard > Settings > Reading > A Static Page > Front page)

Simple solution like this

Using a conditional to display site title when viewing homepage

<?php is_front_page()?bloginfo('name'):wp_title('');  ?>

Complete code like this

<?php is_front_page()?bloginfo('name'):wp_title(''); wp_title(''); ?>

Post/page outputs: Page Title

Homepagd outputs: Site Name






Article Name
WordPress Title Empty on Index Page
Code snippet to fix empty wp_title when using a static page on index/homepage