WPML
wpml_media_id
Type
filter
WPML Version
4.6.10

Description

Note: This filter is available as of WPML Media Translation 2.7.4

This filter allows you to convert a media ID to the current language or a specified target language. If the language is not provided to the filter, it will use the current language by default.

Arguments

$id
(int) (Required) The media ID.
$language
(string) (Optional) The language code of the target language. The current language is the default.

Example usage

Example
// Convert the media ID to the current language.
apply_filters( 'wpml_media_id', 123 );

// Convert the media ID to French.
apply_filters( 'wpml_media_id', 123, 'fr' );

wpml_media_url, force_suppress_filters, wpml_get_translated_slug, wpml_home_url, wpml_translate_single_string, wpml_translate_string, wpml_elements_without_translations, wpml_permalink, wpml_unfiltered_admin_string, wpml_element_link

All 12 Retrieving Localized Content hooks →