При сохранении продукта с аттрибутами, с помощью плагина ecommerce product catalog, выдает ошибку 500.
ЛОГ:
Fatal error: Uncaught Error: Cannot use object of type WP_Error as array in /home/c/123/wordpress_12/public_html/wp-content/plugins/ecommerce-product-catalog/modules/attributes/product-attributes.php:63 Stack trace: #0 /home/c/123/wordpress_12/public_html/wp-content/plugins/ecommerce-product-catalog/modules/attributes/product-attributes.php(99): ic_add_product_attribute_value('353', '\xD0\x90\xD0\xBF\xD0\xBF\xD0\xB0') #1 /home/c/cj29916/wordpress_12/public_html/wp-includes/class-wp-hook.php(298): ic_assign_product_attributes(Array, Object(WP_Post)) #2 /home/c/123/wordpress_12/public_html/wp-includes/plugin.php(203): WP_Hook->apply_filters(Array, Array) #3 /home/c/123/wordpress_12/public_html/wp-content/plugins/ecommerce-product-catalog/includes/product.php(270): apply_filters('product_meta_sa...', Array, Object(WP_Post)) #4 /home/c/cj29916/wordpress_12/public_html/wp-includes/class-wp-hook.php(300): implecode_save_products_meta(1329,
Object(WP_Post)) #5 /home/c/cj29916/wordpress_12/public_html/wp-includes/ in /home/c/123/wordpress_12/public_html/wp-content/plugins/ecommerce-product-catalog/modules/attributes/product-attributes.php on line 63
КОД:
function ic_add_product_attribute_value( $label_id, $value ) {
$term = term_exists( $value, 'al_product-attributes', $label_id );
if ( empty( $term ) ) {
$term = wp_insert_term( $value, 'al_product-attributes', array( 'parent' => $label_id ) );
}
return $term[ 'term_id' ];
}
Помогите пожалуйста!