WC_Customer_Download_Log_Data_Store::delete_by_permission_id()
Method to delete download logs for a given permission ID.
Method of the class: WC_Customer_Download_Log_Data_Store{}
No Hooks.
Return
null
. Nothing (null).
Usage
$WC_Customer_Download_Log_Data_Store = new WC_Customer_Download_Log_Data_Store(); $WC_Customer_Download_Log_Data_Store->delete_by_permission_id( $id );
- $id(int) (required)
- download_id of the downloads that will be deleted.
Changelog
Since 3.4.0 | Introduced. |
WC_Customer_Download_Log_Data_Store::delete_by_permission_id() WC Customer Download Log Data Store::delete by permission id code WC 9.4.2
public function delete_by_permission_id( $id ) { global $wpdb; $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions WHERE permission_id = %d", $id ) ); // Delete related records in wc_download_log (aka ON DELETE CASCADE). $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}wc_download_log WHERE permission_id = %d", $id ) ); }