• Resolved iamwpuser

    (@iamwpuser)


    Hello,

    How can I change this:

    <meta property="og:locale" content="ru_RU" class="yoast-seo-meta-tag" />

    to this:

    <meta property="og:locale" content="ru_UA" class="yoast-seo-meta-tag" />


    I have tryed

    this

    function modify_og_locale( $locale ) {
    // Проверяем, если это русская версия
    if ( $locale === 'ru_RU' ) {
    return 'ru-UA'; // Меняем на ru-UA
    }
    return $locale;
    }
    add_filter( 'wpseo_locale', 'modify_og_locale' );




    and this


    function override_og_locale() {
    // Удаляем старый мета-тег, добавленный Yoast
    remove_action( 'wpseo_head', array( 'WPSEO_Frontend', 'og_locale' ), 5 );

    // Добавляем новый тег с измененным значением
    echo '<meta property="og:locale" content="ru-UA" class="yoast-seo-meta-tag" />';
    }
    add_action( 'wpseo_head', 'override_og_locale', 1 );



    not helps

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support Mushrit Shabnam

    (@611shabnam)

    Hi @iamwpuser

    OpenGraph has a?limited list of supported?og:locale?designations. If your locale is not in this list, our plugin will output the best match for your language.

    You can follow developer blog to find an example code and the list of supported og:locale tag.

    Thread Starter iamwpuser

    (@iamwpuser)

    Thread Starter iamwpuser

    (@iamwpuser)

    So if I can not edite ru-ru, I have to delite this string <meta property=”og:locale” content=”ru_RU” class=”yoast-seo-meta-tag” />

    Thread Starter iamwpuser

    (@iamwpuser)

    I can use only ru or ru-ua, ru-ru hurts my site’s search engine visibility!

    HOW CAN I DELETE THIS STRING

    <meta property="og:locale" content="ru_RU" class="yoast-seo-meta-tag" />

    ???????????????????????????????????????????????????????????

    Thread Starter iamwpuser

    (@iamwpuser)

    also I have tried this:

    add_filter( ‘wpseo_locale’, function( $locale ) {
    // Убираем вывод тега
    return ”;
    } );

    and this:

    add_action( ‘wpseo_head’, function() {
    // Удаляем вывод тега
    ob_start(function($output){
    return preg_replace(‘/]+>/i’, ”, $output);
    });
    }, 9999 );

    Not helps, can anybody help?

    Thread Starter iamwpuser

    (@iamwpuser)

    ok,ok, I have deleted <meta property=”og:locale” content=”ru_RU” class=”yoast-seo-meta-tag” /> with

    function remove_locale_presenter( $presenters ) {
    return array_filter( $presenters, function( $presenter ) {
    // Удаляем Locale_Presenter, чтобы он не выводил
    return ! ( $presenter instanceof Yoast\WP\SEO\Presenters\Open_Graph\Locale_Presenter );
    });
    }

    add_filter( ‘wpseo_frontend_presenters’, ‘remove_locale_presenter’ );

    But I can not delete this string in the same way

    <meta property="og:locale:alternate" content="ru_RU" />

    HOW TO DELETE THIS og:locale:alternate STRING?

    • This reply was modified 2 months, 2 weeks ago by iamwpuser.
    Thread Starter iamwpuser

    (@iamwpuser)

    Thread Starter iamwpuser

    (@iamwpuser)

    this

    function remove_locale_and_alternate_presenters( $presenters ) {
    return array_filter( $presenters, function( $presenter ) {
    // Удаляем Locale_Presenter и Locale_Alternate_Presenter
    return ! ( $presenter instanceof Yoast\WP\SEO\Presenters\Open_Graph\Locale_Presenter ||
    $presenter instanceof Yoast\WP\SEO\Presenters\Open_Graph\Locale_Alternate_Presenter );
    });
    }

    add_filter( ‘wpseo_frontend_presenters’, ‘remove_locale_and_alternate_presenters’ );

    and this

    function remove_locale_and_alternate_presenters( $presenters ) {
    return array_filter( $presenters, function( $presenter ) {
    // Удаляем Locale_Presenter и Locale_Alternate_Presenter
    return ! ( $presenter instanceof Yoast\WP\SEO\Presenters\Open_Graph\Locale_Presenter ||
    $presenter instanceof Yoast\WP\SEO\Presenters\Open_Graph\Locale_Alternate_Presenter );
    });
    }

    add_filter( ‘wpseo_frontend_presenters’, ‘remove_locale_and_alternate_presenters’ );

    and this

    function remove_yoast_og_locale_alternate( $presenters ) {
    return array_filter( $presenters, function( $presenter ) {
    // Убираем не только Locale_Presenter, но и Locale_Alternate_Presenter
    if ( $presenter instanceof Yoast\WP\SEO\Presenters\Open_Graph\Locale_Alternate_Presenter ) {
    return false;
    }
    return true;
    });
    }

    add_filter( ‘wpseo_frontend_presenters’, ‘remove_yoast_og_locale_alternate’ );

    NOT HELPS, DO YOU KNOW HOW?

    Plugin Support Mushrit Shabnam

    (@611shabnam)

    Hi @iamwpuser

    I understand you are trying to remove og:locale:alternate property from page source. Unfortunately, there is no specific filter to remove the og:locale:alternate property.

    This will require custom code. Unfortunately we can’t offer support on custom code. Since we don’t want to take the risk that we break your website by suggesting incorrect or incomplete code, we cannot advise you on how to make such changes.

    Feature request:

    Thank you for suggesting a new feature for one of our plugins! You’re not the first to have requested this feature! That means a feature request has been created internally and is under review by our product team.

    What’s next?
    Our product team will assess the feature request and assign a priority level to the report. Our developers work on the highest priority issues first. We cannot give you an estimate of when or if they’ll start working on the request.

    If you have any further information that may affect the prioritization, please feel invited to reply to this forum topic, and we’ll share the information with our product team.

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.