wpml_media_id
- 类型
- filter
- 类别
- 获取本地化内容
- WPML 版本
- 4.6.10
说明
注意:此过滤器自 WPML Media Translation 2.7.4 起可用。
此过滤器允许您将媒体 ID 转换为当前语言或指定的目标语言。如果未向该过滤器提供语言,它将默认使用当前语言。
参数
- $id
- (int)(必填)媒体 ID。
- $language
- (string)(可选)目标语言的语言代码。默认为当前语言。
使用示例
示例
// 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