首页 文章

更改由yoast SEO插件设置的Wordpress区域设置

提问于
浏览
1

我的WordPress网站位于英国 . 我能够将html lang -attribute从 en-US 更改为 en-GB ,但是当我查看我的源代码时,打开图的 og:locale 属性显示为 en-US ,它是由yoast SEO插件生成的 . 有没有办法将区域设置更改为 en-GB

1 回答

  • 6

    来自the documentation

    wpseo_locale(string)允许更改opengraph集中使用的语言环境(以及稍后可能在其他位置) .

    这是a specific example其他人如何在functions.php中解决它:

    add_filter('wpseo_locale', 'override_og_locale');
    function override_og_locale($locale)
    {
        return "en_GB";
    }
    

相关问题