Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Action Reference/edit user profile

This page is marked as incomplete. You can help Codex by expanding it.


This action hook is typically used to output new fields or data to the bottom of WordPress's user profile pages.

This hook only triggers when a user is viewing another users profile page (not their own). If you want to apply your hook to ALL profile pages (including the current user) then you also need to use the show_user_profile hook.


(object) (optional) The WP_User object of the user being edited.
Default: None


 * Show custom user profile fields
 * @param  object $profileuser A WP_User object
 * @return void
function custom_user_profile_fields( $profileuser ) {
	<table class="form-table">
				<label for="user_location"><?php esc_html_e( 'Location' ); ?></label>
				<input type="text" name="user_location" id="user_location" value="<?php echo esc_attr( get_the_author_meta( 'user_location', $profileuser->ID ) ); ?>" class="regular-text" />
				<br><span class="description"><?php esc_html_e( 'Your location.', 'text-domain' ); ?></span>
add_action( 'show_user_profile', 'custom_user_profile_fields', 10, 1 );
add_action( 'edit_user_profile', 'custom_user_profile_fields', 10, 1 );

Source File

The edit_user_profile hook is located in /wp-admin/user-edit.php


Return to Plugin API/Action Reference