• Resolved satishraj19

    (@satishraj19)


    Hi,

    Trying to custom <title> meta, but when i change title its changing og:title and twitter title also, but i need only to change <title> meta, Please suggest me, how can i do that. if not possible, tell me how can i disable only title meta tag in post. (Keeping og:title and Twitter Title). then i can add custom title meta tag in my theme header…

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Gal Baras

    (@galbaras)

    See https://rankmath.com/kb/open-graph-meta-tags/. The plugin already supports overriding these social titles in the Social tab of the post/page SEO settings.

    Thread Starter satishraj19

    (@satishraj19)

    Thanks for Your Suggestion, But my Query is not You Mentioned…

    1). Need to set <title> </title> Meta tag as a ABCDEF (Example)

    Og:title should XYZ

    Means in the title i am trying to add custom words, but not in og:title and twitter title….

    Gal Baras

    (@galbaras)

    In the Social tab, you can set the Facebook title (og:title) to something specific, then Separate the Twitter snippet from the Facebook one and set a specific Twitter title.

    If this doesn’t work on your site, maybe you can share some screenshots.

    Thread Starter satishraj19

    (@satishraj19)

    We Did That, But After Change Title meta tag, the og:title also changing.. wait i will explain what we did..

    We used below codes

    add_filter( “rank_math/opengraph/facebook/og_title”, function( $content ) {
    $content = ”;
    return $content;
    });

    add_filter( “rank_math/opengraph/twitter/twitter_title”, function( $content ) {
    $content = ”;
    return $content;
    });

    Result : og:title and Twitter Title was Now Disabled, then we created Custom Title For <title> meta tag. after this, og;title and twitter title came back and showing same custom title.. Means above code not works if we create custom <title> meta tag

    Please Refer the Bellow Image, we expecting this result..

    Thread Starter satishraj19

    (@satishraj19)

    When we change title for facebook, its working, in post editor we changed title for facebook then title was different, we got the we expected result. But how can we set it Default title for facebook, otherwise every time we should edit the facebook title tab.

    So Please Suggest me set how to set Default title for social media?

    Thanks

    Are you changing the SEO title or the post title? I think the variable %title% is the post title, which appears as the H1 element on the front end, while the SEO title can be set via the Rank Math snippet settings.

    If you’re happy to use a filter to set the titles to the post title, try this:

    add_filter( 'rank_math/opengraph/facebook/og_title', 'custom_return_post_title' );
    add_filter( 'rank_math/opengraph/facebook/twitter_title', 'custom_return_post_title' );
    function custom_return_title( $content ) {
    return get_the_title();
    }

    This will ensure that no matter what the SEO title is, the social titles will match the post title.

    Thread Starter satishraj19

    (@satishraj19)

    Thanks for the code, please check once again the code.. after insert this code my site showing There has been a critical error on your website.

    Thread Starter satishraj19

    (@satishraj19)

    Thanks its worked, you are great

    missing “Post” in custom_return, i have added its worked… thanks

    function custom_return_title( $content ) {
    return get_the_title();
    }

    Thread Starter satishraj19

    (@satishraj19)

    @galbaras Above Code Works for Global, i need this to work only post, now its changing output of Categories and pages also, Please can you suggest me or please alter the code

    Thanks in Advance

    Try this:

    add_filter( 'rank_math/opengraph/facebook/og_title', 'custom_return_post_title' );
    add_filter( 'rank_math/opengraph/facebook/twitter_title', 'custom_return_post_title' );
    function custom_return_post_title( $content ) {
    if ( is_single() ) {
    return get_the_title();
    }
    return $content;
    }

    You can add check for page (is_page()) and others as required in the if statement.

    Thread Starter satishraj19

    (@satishraj19)

    Thanks, its Worked as i expected

Viewing 11 replies - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.