I have a problem using $wpdb->query.
I have a piece of code similar to this:
$meta_value = get_user_meta($user_id, 'mbids_standard_points'); $wpdb->query("UPDATE wp_usermeta SET meta_value = meta_value + '1' WHERE meta_key='mbids_standard_points'"); $updated_value = get_user_meta($user_id, 'mbids_standard_points');
The problem is that $updated_value doesn’t change after the query. But does change on the next page reload. Is there a mistake in this code?
UPD: I figured out that WP caches usermeata. Is there a way to purge it?
- The topic ‘$wpdb query takes effect only on the next request’ is closed to new replies.