Archived topic
title-tag empty on index
9 replies · Started by generator on August 21, 2018
Hello,
I realized suddenly my <title> on index-page is empty.
But it's there on subpages.
A few days ago I deleted the Title in the settings tab, because I only wanted the page-title showing up as <title>
But on that day everything worked fine, but now the whole title-tag is empty.
Can you please help?
The only other thing I did is, I updated a Elementor Addon by Livemesh, I already checked via deactivating it, it doesn't solve the problem
Hi there,
Is there a specific page or element I should be looking at?
Keep in mind that if it's something to do with Elementor then it's best to ask their support :)
Yes on the title tag of the home-page.
(And because of that the home pages browser tab contains only the domain name, not the title I entered.)
This is because the title tag on the home page (on the index.php) is empty, but there should actually be the title I entered in the wordpress-page-backend.
The titles on subpages work correctly, they contain the title I entered in their pages.
It can actually not be caused by Elementor because the page title comes from the ordinary wordpress-page-backend. I already checked that by deactivating their plugins.
So something is entered in Site Title here?
https://docs.generatepress.com/article/site-title-tagline/
No there is nothing entered, because I dont wanted it to appear in browser tab (and in search result title) as a second title behind the page title.
But even IF I enter a title there, THIS title shows up but not the one I entered in the pages title field.
This only happens on index page.
I already found some other posts on the internet about this problem. Should I create a child of the index.php and enter these codes in the title-tag to fix it?
But strange it happened just a little while ago, it worked fine all the time before.
The mentioned links are:
https://wordpress.stackexchange.com/questions/43619/empty-title-on-front-page-home
https://pixert.com/blog/wordpress-title-empty-on-index-page/
Have you considered using a plugin like Yoast SEO? It allows you to manually set your title tag on each page.
I had no need to use Yoast because individual page titles already came from the wordpress-page-title-field in the backend. This worked fine since forever without any coding, just by default. But now suddenly the tag is empty (or only filled with the title from settings tab).
EDIT: Ok, now I tried to simply add it using a Hook-Element wp_head but it doesn't show up. Can you recommend a filter for the functions.php that touches the front-page title, so I can set it this way.
Or how can I otherwise edit your title-tag, I wanted to add code mentioned in the links here in this thread.
Give this function a try:
add_filter( 'document_title_parts', function( $title ) {
if ( is_front_page() ) {
$title['title'] = 'Your home page title';
}
return $title;
} );
Let me know :)
Ok, thank you very much that worked.
You're welcome :)