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 10 replies, has 2 voices.

Last updated by Harshad 5 years, 1 month ago.

Assigned support staff: Harshad.

Author Posts
July 20, 2014 at 11:30 am #439210

Pieter

Hi, on a multilingual site I'm building I have come across a problem with the attachment pages.

PDF Documents that are uploaded to a Page are linking to the single attachment page, however the link that the Media Uploader automatically inserts misses the language code for all languages including the default (see screenshot). My setup is languages in directories and the default language also has its own directory.

Apart from informing the client to manually add the language code for all uploaded documents (hundreds) in all 5 languages, is there a real solution to this problem?

I did a quick search in the forums and this problem seems to have manifested itself in the past too, but solutions were never posted...

July 20, 2014 at 1:57 pm #439243

Harshad

Dear Piet,

Are you uploading the attachments with language changed from Admin Top bar?

I mean if you want to upload a document for Spanish language, before uploading have you changed the language to Spanish from admin top bar in Media Library?

July 20, 2014 at 2:24 pm #439257

Pieter

Hi Harshad, that is not the point.
site.com 5 languages: en/nl/fr/de/es, all of them in directory structure, so
site.com/en/
site.com/nl/
site.com/fr/
site.com/de/
site.com/es/

When I am on the English page and I attach documents to that page, I want the links to go to the single attachment page, but in the Media Uploader (where the screenshot is of) the language code is not added and therefore my links result in 404s.

Links I get:
domain.com/find/documents/attachment/abundant-money-francis-ayley-lia-ayley-2005/
domain.com/zoek/bestanden/attachment/abundant-money-francis-ayley-lia-ayley-2005-2/
domain.com/trouver/documents/attachment/abundant-money-francis-ayley-lia-ayley-2005-3/
domain.com/suche/publikationen/attachment/abundant-money-francis-ayley-lia-ayley-2005-4/
domain.com/buscar/documentos/attachment/abundant-money-francis-ayley-lia-ayley-2005-5/

NOTE, the file NAMES are correct, just the language-code (read: directory and therefore correct location) is missing.

Links should be:
domain.com/en/find/documents/attachment/abundant-money-francis-ayley-lia-ayley-2005/
domain.com/nl/zoek/bestanden/attachment/abundant-money-francis-ayley-lia-ayley-2005-2/
domain.com/fr/trouver/documents/attachment/abundant-money-francis-ayley-lia-ayley-2005-3/
domain.com/de/suche/publikationen/attachment/abundant-money-francis-ayley-lia-ayley-2005-4/
domain.com/es/buscar/documentos/attachment/abundant-money-francis-ayley-lia-ayley-2005-5/

July 20, 2014 at 2:25 pm #439259

Pieter

So the duplication is going fine, but somewhere when WPML is talking to the Media Uploader things are going not fine...

July 20, 2014 at 2:49 pm #439266

Harshad

Dear Piet,

On website front does your theme uses default wordpress attachment link functions get_attachment link and wp_get_attachment_link?

We need to check if its using custom function.

I need to request temporary access (wp-admin and FTP) to your site - preferably to a test site where the problem has been replicated if possible - in order to be of better help. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

July 20, 2014 at 3:32 pm #439275

Pieter

It has nothing to do with get_attachment link and/or wp_get_attachment_link

you can easily reproduce this by setting up a site with 2 or more languages, then
1. set them to using directories for the default language too
2. make a page
3. upload 3 PDFs to that page
4. in the media upload overlay, choose to link the file NOT to a custom link, NOT to themselves, but to the single attachment page

Then check what the link looks like and you will see that the language parameter is not in there.

can't give you access as it is a local dev

July 20, 2014 at 3:36 pm #439276

Pieter

another screenshot to hopefully make it clear now

July 20, 2014 at 3:41 pm #439278

Pieter

I hardly ever have the need to link files to the attachment page and therefore have not before noticed this bug. Usually I either don't link or link an image to itself to show in a popup or overlay or something like that.

This specific problem only manifests itself when uploading document files like PDFs and you want to link them to the attachment page, mind you one of the default choices of the media uploader...

July 21, 2014 at 7:49 am #439440

Harshad

Dear Piet,

I have tested this on my local install, and looks like a bug, I have reported this to our development team, they will look into this and fix it in upcoming version.

July 21, 2014 at 8:03 am #439463

Pieter

Hi Harshad, glad to hear that you finally understood the issue and have come to the same conclusion.

Hopefully it will be resolved soon as this is an issue that dates back several months (if not years) already now.

I also found another bug with the Media Uploader and WP 4.0-beta-2, but have emailed Amir separately about that as it is for a future WP version.

Cheers,
Piet

July 21, 2014 at 9:05 am #439520

Harshad

Dear Piet,

Hopefully this should get fixed in new version, I will check the other issue with Amir and make sure its added to to-do list, So our development team can work on it.

The topic ‘[Closed] attachment page link misses language code’ is closed to new replies.