Ensure child_ids (transient) is cleared on delete. Closes #1786.
This commit is contained in:
parent
75ca794bba
commit
841624a0b2
|
@ -83,7 +83,8 @@ function woocommerce_ms_protect_download_rewite_rules( $rewrite ) {
|
|||
* @return void
|
||||
*/
|
||||
function woocommerce_delete_post( $id ) {
|
||||
|
||||
global $woocommerce;
|
||||
|
||||
if ( ! current_user_can( 'delete_posts' ) ) return;
|
||||
|
||||
if ( $id > 0 ) :
|
||||
|
@ -103,7 +104,8 @@ function woocommerce_delete_post( $id ) {
|
|||
endif;
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
$woocommerce->clear_product_transients();
|
||||
delete_transient( 'woocommerce_processing_order_count' );
|
||||
}
|
||||
|
||||
|
|
|
@ -393,7 +393,7 @@ class WC_Product {
|
|||
function exists() {
|
||||
global $wpdb;
|
||||
|
||||
return $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE ID = %d LIMIT 1;", $this->id ) ) > 0 ? true : false;
|
||||
return ! empty( $this->post ) || $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE ID = %d LIMIT 1;", $this->id ) ) > 0 ? true : false;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue