Skip Navigation

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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: America/Los_Angeles (GMT-07:00)

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Bobby 1 year ago.

Assisted by: Bobby.

Author Posts
April 3, 2023 at 5:20 pm #13393067

Piotr

Hi,

I am using frontend post submission/editing forms which allow users to select files from media library.
Adding/editing content in all active languages is made through forms embedded into pages in default language. This works except that media library popup obviously shows files assigned to a default language.

Would you provide some hints on how to switch language of media library popup with code? I guess this has something to do with WP_Query? E.g.:

global $sitepress;
$sitepress->switch_lang( xyz );
$abc = new WP_Query( $args );
$sitepress->switch_lang( zyx );

Thanks

April 4, 2023 at 2:03 am #13395263

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hello,

Support for custom work is limited, but I'd recommend reviewing our Hooks Library as a first place

https://wpml.org/documentation/support/wpml-coding-api/wpml-hooks-reference/

You could tap into the database with a SQL query using global $wpdb, $sitepress;

The way the media translation works is by creating an entry in the database rather than an actual media file, maybe this will help put together a solution.
https://wpml.org/documentation/getting-started-guide/media-translation/

If my directions are not enough we suggest contacting one of our 3rd party contractors that specialize in custom work with WPML
https://wpml.org/contractors/

The topic ‘[Closed] Changing Language of Media Library Popup’ is closed to new replies.