Action hook 'added_usermeta'

in WP Core File wp-includes/deprecated.php at line 2364

View Source

added_usermeta

Action Hook
Description
Update metadata of user. There is no need to serialize values, they will be serialized if it is needed. The metadata key can only be a string with underscores. All else will be removed. Will remove the metadata, if the meta value is empty.

Hook Information

File Location wp-includes/deprecated.php View on GitHub
Hook Type Action
Line Number 2364

Hook Parameters

Type Name Description
int $user_id User ID
string $meta_key Metadata key.
mixed $meta_value Metadata value.

Usage Examples

Basic Usage
<?php
// Hook into added_usermeta
add_action('added_usermeta', 'my_custom_function', 10, 3);

function my_custom_function($user_id, $meta_key, $meta_value) {
    // Your custom code here
}

Source Code Context

wp-includes/deprecated.php:2364 - How this hook is used in WordPress core
<?php
2359  
2360  	clean_user_cache( $user_id );
2361  	wp_cache_delete( $user_id, 'user_meta' );
2362  
2363  	if ( !$cur )
2364  		do_action( 'added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value );
2365  	else
2366  		do_action( 'updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
2367  
2368  	return true;
2369  }

PHP Documentation

<?php
/**
 * Update metadata of user.
 *
 * There is no need to serialize values, they will be serialized if it is
 * needed. The metadata key can only be a string with underscores. All else will
 * be removed.
 *
 * Will remove the metadata, if the meta value is empty.
 *
 * @since 2.0.0
 * @deprecated 3.0.0 Use update_user_meta()
 * @see update_user_meta()
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int $user_id User ID
 * @param string $meta_key Metadata key.
 * @param mixed $meta_value Metadata value.
 * @return bool True on successful update, false on failure.
 */
Quick Info
  • Hook Type: Action
  • Parameters: 3
  • File: wp-includes/deprecated.php
Related Hooks

Related hooks will be displayed here in future updates.