- Trạng thái
- Đã giải quyết
- Được báo cáo cho
- WPForms Multilingual 0.3.6
- Đã giải quyết trong
- WPForms Multilingual 0.4.0
- Plugin/giao diện liên quan
- WPForms
- Thẻ chủ đề
- Compatibility
Tổng quan về lỗi
Nếu bạn đang sử dụng WPForms và tiện ích bổ sung WPForms Form Pages của nó, bạn có thể gặp lỗi 404 khi truy cập các trang biểu mẫu bằng các ngôn ngữ phụ với cấu trúc đường dẫn tĩnh tùy chỉnh (ví dụ: /artikel/%postname%/).
Giải pháp tạm thời
Vui lòng đảm bảo sao lưu toàn bộ trang web của bạn trước khi tiếp tục.
- Mở tệp …/wp-content/plugins/wpforms-form-pages/src/Frontend.php.
- Tìm dòng 78.
- Thay thế:
$request = ! empty( $request ) ? sanitize_key( wp_parse_url( $request, PHP_URL_PATH ) ) : '';
- Bằng:
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 = ''; }