• Resolved Nirr

    (@nirmithamw)


    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Anh Tran

    (@rilwis)

    Hi @nirmithamw ,

    The snippet is correct and safe. There’s no problems using it.

    I’m wondering why custom meta title doesn’t work for you in the first place. I’ve just tested again it on my localhost and it works well. Do you use any theme/plugin that has SEO functionality?

    Thread Starter Nirr

    (@nirmithamw)

    Hello, Tran!

    I’m not using any other SEO plugin, and I don’t think my theme has any built in SEO functionality to prevent it.

    I’ll create a staging site and test the issue later. For now, I’ll use that snippet.

    Thanks for the support!

    • This reply was modified 1 month, 1 week ago by Nirr.
    • This reply was modified 1 month, 1 week ago by Nirr.
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.