- Trạng thái
- Đã giải quyết
- Được báo cáo cho
- WPML Multilingual for CF7 1.2.1
- Đã giải quyết trong
- Contact Form 7 Multilingual 1.2.2
- Plugin/giao diện liên quan
- Contact Form 7
- Thẻ chủ đề
- Compatibility
Tổng quan về lỗi
Khi thêm biểu mẫu bằng plugin Contact Form 7 và phương thức PHP do_shortcode(), các biểu mẫu không hiển thị bản dịch như mong đợi.
Giải pháp tạm thời
Vui lòng đảm bảo có bản sao lưu đầy đủ trang web của bạn trước khi tiếp tục.
- Mở tệp …/wp-content/plugins/contact-form-7-multilingual/classes/shortcodes.php.
- Tìm dòng 21.
- Thay thế:
public function translate_shortcode_form_id( $atts ) { $form = null; if ( ! empty( $atts['id'] ) ) { $form = wpcf7_contact_form( (int) $atts['id'] ); } if ( ! $form && ! empty( $atts['title'] ) ) { $form = wpcf7_get_contact_form_by_title( trim( $atts['title'] ) ); unset( $atts['title'] ); } if ( $form ) { $atts['id'] = apply_filters( 'wpml_object_id', $form->id(), Constants::POST_TYPE, true ); } return $atts; } - Bằng:
public function translate_shortcode_form_id( $atts ) { $form = null; if ( ! empty( $atts['id'] ) && is_numeric($atts['id']) ) { $form = wpcf7_contact_form( (int) $atts['id'] ); } if ( ! $form && ! empty( $atts['title'] ) ) { $form = wpcf7_get_contact_form_by_title( trim( $atts['title'] ) ); unset( $atts['title'] ); } if ($form == null){ $form = wpcf7_get_contact_form_by_hash( $atts['id']); } if ( $form ) { $atts['id'] = apply_filters( 'wpml_object_id', $form->id(), Constants::POST_TYPE, true ); } return $atts; }