- สถานะ
- แก้ไขแล้ว
- รายงานสำหรับ
- WPForms Multilingual 0.3.6
- แก้ไขใน
- WPForms Multilingual 0.4.0
- ปลั๊กอิน/ธีมที่เกี่ยวข้อง
- WPForms
- แท็กหัวข้อ
- Compatibility
ภาพรวมของปัญหา
หากคุณกำลังใช้ WPForms และส่วนเสริม WPForms Form Pages คุณอาจพบข้อผิดพลาด 404 เมื่อเข้าถึงหน้าฟอร์มในภาษารองที่มีโครงสร้างลิงก์ถาวรแบบกำหนดเอง (เช่น /artikel/%postname%/)
วิธีแก้ปัญหาชั่วคราว
โปรดตรวจสอบให้แน่ใจว่าคุณได้สำรองข้อมูลไซต์ทั้งหมดก่อนดำเนินการต่อ
- เปิดไฟล์ …/wp-content/plugins/wpforms-form-pages/src/Frontend.php
- ค้นหาบรรทัดที่ 78
- แทนที่:
$request = ! empty( $request ) ? sanitize_key( wp_parse_url( $request, PHP_URL_PATH ) ) : '';
- ด้วย:
if ( ! empty( $request ) ) { // Parse the URL to get the path component $path = wp_parse_url( $request, PHP_URL_PATH ); // Use a regular expression to remove the language segment (e.g., "/en/") from the path // This pattern assumes the language code is always two characters and follows the first "/" $path = preg_replace( '#^/([a-zA-Z]{2})/#', '/', $path ); // Sanitize the resulting path $request = sanitize_key( $path ); } else { $request = ''; }