Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:

Yoast-schema-graph showing mixed URLs for the default language.

Solution:

The issue is escalated to our developers and will be fixed in a future version of WPML SEO. Meanwhile, please apply the suggested workaround to resolve the issue on your site.

1. Edit the functions.php file of your theme with a code editor or in Appearance -> Theme Editor.

2. Add this function and save the change.

add_action('wpseo_frontend_presentation', function($presentation, $context) {
    $context->site_url = home_url();
  
    if (!empty($context->company_logo_meta)) {
        $translated_img = wp_get_attachment_image_src($context->company_logo_meta['id'], 'full');
        $context->company_logo_meta['url'] = !empty($translated_img[0]) ? $translated_img[0] : $context->company_logo_meta['url'];
    }
  
    return $presentation;
}, 10, 2);

3. Make a small change on the default language page and press the Update button. And also update the translations of the pages.

**** Important! Please make a full site backup (files and DB) before you proceed with those steps****

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 2 replies, has 2 voices.

Last updated by Raphael Cavalieri 1 year, 11 months ago.

Assisted by: Itamar.

Author Posts
April 21, 2022 at 8:44 am

Raphael Cavalieri

I am contacting you because I have found a problem with the multinlingual and more specifically the SEO data in the structured data of our site because we have information on the Spanish site in the French page where the reverse is not the case. So I wanted to know how this is possible.

I am sending you a screenshot of the problem.

So basically why Yoast is based on reino minerales rather than the correct site... France Minéraux

Thank you very much.

April 21, 2022 at 9:09 am
April 25, 2022 at 2:35 pm #11090841

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi,

I'll continue helping you with this issue.

It is a known issue that was already reported to us. You can see a reference for this at the following link to the related forum ticket.

https://wpml.org/forums/topic/yoast-schema-graph-showing-mixed-url-for-the-secondary-languages/

The issue is escalated to our developers and will be fixed in a future version of WPML SEO. Meanwhile, please apply the suggested workaround to resolve the issue on your site.

1. Edit the functions.php file of your theme with a code editor or in Appearance -> Theme Editor.

2. Add this function and save the change.

add_action('wpseo_frontend_presentation', function($presentation, $context) {
    $context->site_url = home_url();
 
    if (!empty($context->company_logo_meta)) {
        $translated_img = wp_get_attachment_image_src($context->company_logo_meta['id'], 'full');
        $context->company_logo_meta['url'] = !empty($translated_img[0]) ? $translated_img[0] : $context->company_logo_meta['url'];
    }
 
    return $presentation;
}, 10, 2);

3. Make a small change on the default language page and press the Update button. And also update the translations of the pages.

**** Important! Please make a full site backup (files and DB) before you proceed with those steps****

Regards,
Itamar.

April 26, 2022 at 9:21 am #11095055

Raphael Cavalieri

Hello,

Perfect, it worked very well, I now have the right structured data

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.