Fix Unknown column '_customer_user' notice

When deleting a user. Also ensures the customer value on orders is set
correctly to a guest user (0).
This commit is contained in:
Brent Shepherd 2016-01-06 17:53:21 -08:00
parent d0b82772e0
commit 6d2b570f30
1 changed files with 1 additions and 1 deletions

View File

@ -542,7 +542,7 @@ function wc_get_customer_order_count( $user_id ) {
function wc_reset_order_customer_id_on_deleted_user( $user_id ) {
global $wpdb;
$wpdb->update( $wpdb->postmeta, array( '_customer_user' => 0 ), array( '_customer_user' => $user_id ) );
$wpdb->update( $wpdb->postmeta, array( 'meta_value' => 0 ), array( 'meta_key' => '_customer_user', 'meta_value' => $user_id ) );
}
add_action( 'deleted_user', 'wc_reset_order_customer_id_on_deleted_user' );