- availability:
-
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.
- type:
- filter
- category:
- Retrieving Localized Content
- parameters:
-
- $id
- (int) (Required) The media ID.
- $language
- (string) (Optional) The language code of the target language. The current language is the default.
- hook 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' );