WPDB Insert or if exists Update
First, you are using prepare incorrectly. You seem to have $wpdb->update‘s arguments wrapped in $wpdb->prepare like that. That won’t work. In effect, you are passing update a single argument– the output of prepare. Try something simple like the following and you will see why that won’t work: $post_id = 123; $item_stock = 567; var_dump( $wpdb->prepare( … Read more