WC_Meta_Box_Product_Images::save()public staticWC 1.0

Save meta box data.

Метод класса: WC_Meta_Box_Product_Images{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$result = WC_Meta_Box_Product_Images::save( $post_id, $post );
$post_id(int) (обязательный)
-
$post(WP_Post) (обязательный)
-

Код WC_Meta_Box_Product_Images::save() WC 9.3.3

public static function save( $post_id, $post ) {
	$product_type   = empty( $_POST['product-type'] ) ? WC_Product_Factory::get_product_type( $post_id ) : sanitize_title( stripslashes( $_POST['product-type'] ) );
	$classname      = WC_Product_Factory::get_product_classname( $post_id, $product_type ? $product_type : 'simple' );
	$product        = new $classname( $post_id );
	$attachment_ids = isset( $_POST['product_image_gallery'] ) ? array_filter( explode( ',', wc_clean( $_POST['product_image_gallery'] ) ) ) : array();

	$product->set_gallery_image_ids( $attachment_ids );
	$product->save();
}