How to change meta property=”og:locale” without changing site language in WP.

#214131
  • Hi,

    I want to change the meta property=”og:locale” from en_US to da_DK without changing the site language in WordPress, because we have English-speaking developers.

    So how do I do that?

    Thanks!

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention.

    You can this filter to change the og:locale on your site:

    /**
     * Allow developers to change the content of specific social meta tags.
     *
     * The dynamic part of the hook name. $network, is the network slug
     * and $og_property, is the property which we are outputting.
     *
     * @param string $content The content of the property.
     */
    add_filter( "rank_math/opengraph/facebook/og_locale", function( $content ) {
            $content = 'da_DK';
    	return $content;>
    
    });

    And here’s a link on how to add a filter to your website:
    https://rankmath.com/kb/filters-hooks-api-developer/

    I hope that helps.

    Thank you, and please don’t hesitate to contact us anytime if you need further 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 change meta property=”og:locale” without changing site language in WP.’ is closed to new replies.