WPML
PHP
wpml_media_id

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

  • $idintRequired

    The media ID.
  • $languagestringOptional

    The language code of the target language. The current language is the default.

Example Usage

PHP
// 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' );