delete_images( $post_id )

Summary

No summary available.

Source

File: uninstall.php

function delete_images( $post_id ) {
	$image_ids = \get_posts( [
		'post_type'   => 'attachment',
		'post_parent' => $post_id,
		'meta_query'  => [
			[
				'key'     => 'bigcommerce_id',
				'compare' => '>',
				'value'   => 0,
			],
		],
		'fields'      => 'ids',
	] );
	foreach( $image_ids as $image ) {
		\wp_delete_attachment( $image, true );
	}
}


User Contributed Notes

You must log in before being able to contribute a note or feedback.