WPML

Tổng quan về sự cố

Khi cố gắng dịch một biểu mẫu của plugin Give – Donation, một lỗi nghiêm trọng xảy ra thay vì mở Trình biên tập dịch thuật:

PHP Fatal error: Uncaught TypeError: array_filter(): Argument #1 ($array) must be of type array, string given in .../wp-content/plugins/sitepress-multilingual-cms/classes/translation-jobs/class-wpml-element-translation-package.php:318

Giải pháp tạm thời

Vui lòng đảm bảo có một bản sao lưu đầy đủ cho trang web của bạn trước khi tiếp tục.

  • Mở tệp …/wp-content/plugins/give/includes/database/class-give-db-meta.php.
  • Tìm dòng 151.
  • Thay thế:
    if ( $this->raw_result ) {
    	if ( ! ( $value = get_metadata( $this->meta_type, $id, $meta_key, false ) ) ) {
    		$value = '';
    	}
  • Bằng:
    if ( $this->raw_result ) {
    	if ( ! ( $value = get_metadata( $this->meta_type, $id, $meta_key, false ) ) ) {
    		$value = array();
    	}

Tất cả lỗi đã ghi nhận