WC_Post_Data::delete_postpublic staticWC 1.0

Removes variations etc. belonging to a deleted post, and clears transients, if the user has permission.

Method of the class: WC_Post_Data{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = WC_Post_Data::delete_post( $id );
$id(mixed) (required)
ID of post being deleted.

WC_Post_Data::delete_post() code WC 10.8.1

public static function delete_post( $id ) {
	$container = wc_get_container();
	if ( ! $container->get( LegacyProxy::class )->call_function( 'current_user_can', 'delete_posts' ) || ! $id ) {
		return;
	}

	self::delete_post_data( $id );
}