How to set default language for post to update og:locale?

#580481
  • Resolved Anonymous
    Rank Math free

    My client is writing blog post on their local language, however, I am using WordPress website in English language.

    How can I update SEO language parameter for post and pages to match local language without changing WordPress admin section language (which is English)?

    This is current og parameter for post

    <meta property=”og:locale” content=”en_US” />

    Which I want to match the local language, however, I don’t want to change the language of whole wp admin language.

Viewing 1 replies (of 1 total)
  • Hello,

    Thanks for contacting us, and sorry for any inconvenience that might have been caused due to that.

    Please try applying the following filter on your site to change the value of og:locale property. This will not change the main language of your site. The filter only takes care of the meta tag generated by Rank Math.

    add_filter( "rank_math/opengraph/facebook/og_locale", function( $content ) {
            $content = 'es_AR';
    	return $content;
    });

    Here’s how you can add filters/hooks to your WordPress site:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Hope that helps, and please do not hesitate to let us know if you need our assistance with anything else.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 1 replies (of 1 total)

The ticket ‘How to set default language for post to update og:locale?’ is closed to new replies.