WordPress.org

Codex

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

Function Reference/get edit user link

Description

Gets the link to the users edit profile page in the WordPress admin.

Usage

 <?php get_edit_user_link$user_id ?> 

Parameters

$user_id (integer
  • Optional - The id of the user that you want to get the link for. If no id provided it defaults to the current user.

Examples

Default Usage

Get the edit user link for the user currently viewing the page.

<a href="<?php echo get_edit_user_link(); ?>">name</a>


Get a link for each editor in the database

$user = new WP_User_Query( array(
  'role' => 'editor'
));

$editor = $users->get_results();

foreach( $editor as $e ){
  $userdata = get_userdata( $e->ID );
  echo '<a href="'. get_edit_user_link( $e->ID ) .'">'. esc_attr( $userdata->user_nicename ) .'</a>';
}

Change Log

Source File

get_edit_user_link is located in wp-includes/link-template.php

Related