• Resolved lutfisland

    (@lutfisland)


    Hi,

    I am inspecting the Open Graph script generated by AIO. In the line, I see the script <meta property=”og:locale” content=”en_US” />.

    How can I change this og:locale without needing to modify the site language or user language?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author arnaudbroes

    (@arnaudbroes)

    Hey @lutfisland,

    You can’t change this value in our UI but you should be able to change it with our aioseo_facebook_tags filter hook like this –

    add_filter( 'aioseo_facebook_tags', 'aioseo_filter_og_locale' );
    
    function aioseo_filter_og_locale( $facebookMeta ) {
       if ( isset( $facebookMeta['og:locale'] ) {
           $facebookMeta['og:locale'] = 'en_US';
       }
    
       return $facebookMeta;
    }

    Just replace en_US with the relevant language code.

    Thread Starter lutfisland

    (@lutfisland)

    Thank you @arnaudbroes

    The script can run smoothly on my website. However, the script above still lacks a closing parenthesis ‘)’. Here is the script I am using:

    add_filter( 'aioseo_facebook_tags', 'aioseo_filter_og_locale' );
    
    function aioseo_filter_og_locale( $facebookMeta ) {
    if (isset( $facebookMeta['og:locale'] )) {
    $facebookMeta['og:locale'] = 'id_Id';
    }
    
    return $facebookMeta;
    }
    • This reply was modified 8 months, 2 weeks ago by lutfisland.
    Plugin Author arnaudbroes

    (@arnaudbroes)

    Ah good catch! I’m glad that it is working now!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How do I change the og:locale in the AIO plugin?’ is closed to new replies.