diff --git a/wp-includes/meta.php b/wp-includes/meta.php index 30b38d28b..615fd05a9 100644 --- a/wp-includes/meta.php +++ b/wp-includes/meta.php @@ -59,6 +59,9 @@ function add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique = ) ); wp_cache_delete($object_id, $meta_type . '_meta'); + // users cache stores usermeta that must be cleared. + if ( 'user' == $meta_type ) + wp_cache_delete($object_id, 'users'); do_action( "added_{$meta_type}_meta", $wpdb->insert_id, $object_id, $meta_key, $meta_value ); @@ -119,6 +122,9 @@ function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_v $wpdb->update( $table, $data, $where ); wp_cache_delete($object_id, $meta_type . '_meta'); + // users cache stores usermeta that must be cleared. + if ( 'user' == $meta_type ) + wp_cache_delete($object_id, 'users'); do_action( "updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $meta_value ); @@ -181,6 +187,9 @@ function delete_metadata($meta_type, $object_id, $meta_key, $meta_value = '', $d return false; wp_cache_delete($object_id, $meta_type . '_meta'); + // users cache stores usermeta that must be cleared. + if ( 'user' == $meta_type ) + wp_cache_delete($object_id, 'users'); do_action( "deleted_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $meta_value );