Hi Bricks Team! ![]()
I found a bug with the Carousel element when using WPML for multilingual sites.
What happens:
- I add images to a Carousel on my main language page (e.g., Polish)
Works fine - I translate the page to another language (e.g., English)
- The Carousel on the English page is completely empty
No images!
The weird part:
- Image Gallery element works perfectly with WPML - images show on all languages
- Carousel element doesn’t work - images disappear on translated pages
So it seems like WPML support is missing only in the Carousel element.
How to Reproduce
- Install WPML + WPML Media Translation
- Create a page with a Carousel element (Media type)
- Add some images
- Translate the page to another language
- View the translated page → Carousel is empty!
Now try the same with Image Gallery → Works perfectly!
Why This Happens
I looked into the code and found the issue:
Image Gallery uses wp_get_attachment_image() which WPML automatically filters to show the correct translated images.
Carousel uses a different approach - it queries images by their IDs directly. The problem is that WPML assigns different IDs to translated media, so the Carousel is looking for IDs that don’t exist in the translated language.
Suggested Fix
In helpers.php - translate the image IDs when building the query:
// Around line 3192, change this loop to translate IDs for WPML
if ( \Bricks\Integrations\Wpml\Wpml::is_wpml_active() ) {
$translated_id = apply_filters( 'wpml_object_id', $image_id, 'attachment', true );
$image_id = $translated_id ? $translated_id : $image_id;
}
In carousel.php - add the same pattern as Polylang:
// After the Polylang check around line 404
if ( \Bricks\Integrations\Wpml\Wpml::is_wpml_active() ) {
$query_settings['suppress_filters'] = true;
}