profile_update
Action HookDescription
Fires immediately after an existing user is updated.Hook Information
File Location |
wp-includes/user.php
View on GitHub
|
Hook Type | Action |
Line Number | 2588 |
Hook Parameters
Type | Name | Description |
---|---|---|
int
|
$user_id
|
User ID. |
WP_User
|
$old_user_data
|
Object containing user's data prior to update. |
array
|
$userdata
|
The raw array of data passed to wp_insert_user(). |
Usage Examples
Basic Usage
<?php
// Hook into profile_update
add_action('profile_update', 'my_custom_function', 10, 3);
function my_custom_function($user_id, $old_user_data, $userdata) {
// Your custom code here
}
Source Code Context
wp-includes/user.php:2588
- How this hook is used in WordPress core
<?php
2583 *
2584 * @param int $user_id User ID.
2585 * @param WP_User $old_user_data Object containing user's data prior to update.
2586 * @param array $userdata The raw array of data passed to wp_insert_user().
2587 */
2588 do_action( 'profile_update', $user_id, $old_user_data, $userdata );
2589
2590 if ( isset( $userdata['spam'] ) && $userdata['spam'] !== $old_user_data->spam ) {
2591 if ( '1' === $userdata['spam'] ) {
2592 /**
2593 * Fires after the user is marked as a SPAM user.
PHP Documentation
<?php
/**
* Fires immediately after an existing user is updated.
*
* @since 2.0.0
* @since 5.8.0 The `$userdata` parameter was added.
*
* @param int $user_id User ID.
* @param WP_User $old_user_data Object containing user's data prior to update.
* @param array $userdata The raw array of data passed to wp_insert_user().
*/
Quick Info
- Hook Type: Action
- Parameters: 3
- File: wp-includes/user.php
Related Hooks
Related hooks will be displayed here in future updates.