Bugfix: use "post_modified" instead of "post_date"; Moved modified_date update to woocommerce_update_product_variation code path

We should only set „post_modified“ if we are updating the variation
This commit is contained in:
Florian Ludwig 2015-11-20 18:00:10 +01:00
parent 477da091db
commit 787ebb0ef5
1 changed files with 9 additions and 4 deletions

View File

@ -1324,7 +1324,15 @@ class WC_Meta_Box_Product_Data {
} else {
$wpdb->update( $wpdb->posts, array( 'post_status' => $post_status, 'post_title' => $variation_post_title, 'menu_order' => $variable_menu_order[ $i ] ), array( 'ID' => $variation_id ) );
$modified_date = current_time( 'timestamp' );
$wpdb->update( $wpdb->posts, array(
'post_status' => $post_status,
'post_title' => $variation_post_title,
'menu_order' => $variable_menu_order[ $i ],
'post_modified' => $modified_date,
'post_modified_gmt' => get_gmt_from_date( $modified_date )
), array( 'ID' => $variation_id ) );
clean_post_cache( $variation_id );
@ -1528,9 +1536,6 @@ class WC_Meta_Box_Product_Data {
delete_post_meta( $variation_id, $key );
}
$modified_date = current_time( 'timestamp' );
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_date = %s, post_date_gmt = %s WHERE ID = %s", $modified_date, get_gmt_from_date( $modified_date ), $variation_id ) );
do_action( 'woocommerce_save_product_variation', $variation_id, $i );
}
}