WPML
wpml_media_url
ประเภท
filter
เวอร์ชันของ WPML
4.6.10

คำอธิบาย

หมายเหตุ: ฟิลเตอร์นี้มีให้ใช้งานตั้งแต่ WPML Media Translation 2.7.4 เป็นต้นไป

ฟิลเตอร์นี้ช่วยให้คุณแปลง URL ของสื่อเป็นภาษาปัจจุบันหรือภาษาปลายทางที่ระบุได้ หากไม่ได้ระบุภาษาให้กับฟิลเตอร์ ระบบจะใช้ภาษาปัจจุบันเป็นค่าเริ่มต้น

อาร์กิวเมนต์

$url
(string) (จำเป็น) URL ของสื่อ
$language
(string) (เลือกได้) รหัสภาษาของภาษาปลายทาง ภาษาปัจจุบันคือค่าเริ่มต้น

ตัวอย่างการใช้งาน

ตัวอย่าง
// Convert the media URL to the current language.
apply_filters( 'wpml_media_url', 'https://example.com/wp-content/uploads/dog.jpg' );

// Convert the media URL to French.
apply_filters( 'wpml_media_url', 'https://example.com/wp-content/uploads/dog.jpg', 'fr' );

// Convert the media thumbnail URL to French.
apply_filters( 'wpml_media_url', 'https://example.com/wp-content/uploads/dog-150x150.jpg', 'fr' );

wpml_media_id, 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

ฮุก การดึงเนื้อหาที่ปรับให้เข้ากับท้องถิ่น ทั้งหมด 12 รายการ →