How to remove OG:LOCALE from Yoast in WordPress Manually

Yoast is a popular WordPress plugin that helps users optimize their site for search engines. It also provides a lot of information about the site such as the title, meta description, and keywords. One of these features is OG:LOCALE which displays the language settings of the website.

Many people are not aware of the fact that Yoast SEO plugin has a setting for OG:LOCALE. This setting is used to translate Yoast settings into different languages.

The problem is that many people don’t know how to remove this setting manually.

In this article, we will show you how to remove OG:LOCALE from Yoast in WordPress without a plugin.

1- Remove the og:locale using Yoast Documentation

This code snippet from yoast documentation works in most cases. In case you are using PHP 5.2 on your server, this snippet might not work. Please make a backup before attempting to make any changes to the code, as we cannot be certain of what will happen on your specific site.

function remove_locale_presenter( $presenters ) {
return array_map( function( $presenter ) {
Yoast\WP\SEO\Presenters\Open_Graph\Locale_Presenter ) {
return $presenter;
}, $presenters );
add_action( 'wpseo_frontend_presenters', 'remove_locale_presenter' );

2- Remove the og:locale using from the Yoast Plugin File

After  hours of research on how we can remove og:locale from one of the website that we worked on, we finally found a way to delete / comment out og:locale tweaking the plugin files. 

Although this method worked for us, and has not been published on the developer’s site please note this method is not the official way to stop og:locale from rendering on the front-end.

- Locate your plugin File

Click on  Plugin Editor

- Select the plugin to Edit

– In here, select Yoast SEO Premium

Select Frontend -> class-opengraph.php

Look for the line add_action( 'wpseo_opengraph', array( $this, 'locale' ), 1 ) and comment it out adding // at the beginning of the line.

– Update / Save the file

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée.