On this video I’m going to point out you how you can appropriately take away Woocommerce from WordPress in a manner that it’ll not depart any mess behind. It signifies that all of the product photos shall be eliminated together with it.
So, first I’d recommend you to try the video right here beneath, after which precisely what to do.
Video: Easy methods to Appropriately Take away Woocommerce from WordPress?
Code snippet for possibility 1
outline( 'WC_REMOVE_ALL_DATA', true );
Code snippet for possibility 3
// Robotically Delete Woocommerce Photos After Deleting a Product
add_action( 'before_delete_post', 'delete_product_images', 10, 1 );
operate delete_product_images( $post_id )
{
$product = wc_get_product( $post_id );
if ( !$product ) {
return;
}
$featured_image_id = $product->get_image_id();
$image_galleries_id = $product->get_gallery_image_ids();
if( !empty( $featured_image_id ) ) {
wp_delete_post( $featured_image_id );
}
if( !empty( $image_galleries_id ) ) {
foreach( $image_galleries_id as $single_image_id ) {
wp_delete_post( $single_image_id );
}
}
}