Ensure child_ids (transient) is cleared on delete. Closes #1786.
This commit is contained in:
parent
75ca794bba
commit
841624a0b2
|
@ -83,6 +83,7 @@ function woocommerce_ms_protect_download_rewite_rules( $rewrite ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function woocommerce_delete_post( $id ) {
|
function woocommerce_delete_post( $id ) {
|
||||||
|
global $woocommerce;
|
||||||
|
|
||||||
if ( ! current_user_can( 'delete_posts' ) ) return;
|
if ( ! current_user_can( 'delete_posts' ) ) return;
|
||||||
|
|
||||||
|
@ -104,6 +105,7 @@ function woocommerce_delete_post( $id ) {
|
||||||
|
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
$woocommerce->clear_product_transients();
|
||||||
delete_transient( 'woocommerce_processing_order_count' );
|
delete_transient( 'woocommerce_processing_order_count' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -393,7 +393,7 @@ class WC_Product {
|
||||||
function exists() {
|
function exists() {
|
||||||
global $wpdb;
|
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