Increment value (value = value+1) of $wpdb->update

You don’t. Not with the WPDB update() function. The update function assumes that the values of the columns are strings. You can override that with the format parameter, but that only allows %d, %f, and %s (integer, float, string). It doesn’t allow operations on columns like total+1.

You’d have to use the query() function directly to do your update.

Leave a Comment