Skip to content Skip to sidebar

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.

Sun Mon Tue Wed Thu Fri Sat
- 6:00 – 12:00 8:00 – 12:00 6:00 – 12:00 8:00 – 12:00 6:00 – 12:00 -
- 13:00 – 15:00 13:00 – 17:00 13:00 – 15:00 13:00 – 17:00 13:00 – 15:00 -

Supporter timezone: America/Lima (GMT-05:00)

This topic contains 4 replies, has 2 voices.

Last updated by Nicolas V. 1 year, 2 months ago.

Assisted by: Nicolas V..

Author Posts
May 6, 2024 at 6:11 am #15595091

simonasD
wp-seo-multilingual/classes/class-wpml-wpseo-xml-sitemaps-filter.php:351 

$output .= "\t\t\t<image:loc>" . $image['src'] . "</image:loc>\n";

Here $image['src'] should be parsed with `htmlspecialchars` as other url I think, otherwise if image url has "&" character it breaks sitemap.xml

May 6, 2024 at 4:41 pm #15598714

Nicolas V.
Supporter

Languages: English (English ) French (Français )

Timezone: America/Lima (GMT-05:00)

Hello Simonas,

Welcome to the WPML support forum. Thanks for reporting this issue.

Just to be sure, what are the steps to reproduce the issue?
- Setup WPML with 2 languages + Yoast (or Rank Math) + WPML SEO
- Create a post or a page with an image with the url/filename containing "&"
- Translate that post/page
- Check the sitemap on the frontend to see the error

May 6, 2024 at 4:58 pm #15598784

Nicolas V.
Supporter

Languages: English (English ) French (Français )

Timezone: America/Lima (GMT-05:00)

Hello again,

I did a quick test and WordPress will automatically remove the special character from the filename when uploading it to the media library.

Did you upload the image directly on your server?

screenshot-2024.05.06-11_57_04.png
May 7, 2024 at 6:14 am #15599898

simonasD

Yes, wp removes any special characters for uploaded media files, but i'm using custom blocks which adds additional parameters to image url on that block only.
For example it adds this string to image url: ?w=200&h=200 - these params are used to transform image with third party service.

May 7, 2024 at 9:32 pm #15603912

Nicolas V.
Supporter

Languages: English (English ) French (Français )

Timezone: America/Lima (GMT-05:00)

Hello,

Thanks for the clarification. Could you try to reproduce the issue on the test site I created?
hidden link (one click login)

- Install only the necessary plugins to reproduce the issue. Please don't install any other plugins nor a copy of your entire site.
- If the issue is reproduced on that clean setup, then I can forward this to our 2nd tier support team.

What I don't understand is how Yoast (or Rank Math) would pick those parameters and add them in their sitemaps. It should take the file URL and not some extra parameters added by a custom plugin/block.

The topic ‘[Closed] wp-seo-multilingual plugin should parse image urls in sitemap too’ is closed to new replies.