SEO Title Issue
-
Hello!
I need to show different title for Google rather than the article title that show when reading the actual article.
This is called SEO title.
Actual article title: AI Face Changer
SEO Title: AI Face Changer: BUY 60% OFF or FREE Key?I can set it on Meta title section when editing the post.
However, I found that, Google still showing the Actual article title on SERP.
When I investigate the issue, I found that, in the html code, it has the <title>AI Face Changer</title>.
It should show <title>AI Face Changer: BUY 60% OFF or FREE Key?</title>, isn’t it?
Why this happen?
To resolve the issue, after reading your docs and using ChatGPT, I created a function.
add_filter( 'slim_seo_meta_title', function( $title, $object_id ) {
// Check if the post has a manual Slim SEO meta title set.
$meta = get_post_meta( $object_id, 'slim_seo', true );
if ( ! empty( $meta['title'] ) ) {
return $meta['title']; // Use the Slim SEO meta title.
}
// If no manual title is set, fall back to the default title.
return $title;
}, 10, 2 );After adding this function, I do see <title>AI Face Changer: BUY 60% OFF or FREE Key?</title> in the code.
Can you confirm my solution is safe to use?
Thanks in advance!
Nirmitha.
- You must be logged in to reply to this topic.