get_edit_profile_url

Retrieves the URL to the user's profile editor.

Description

(string) get_edit_profile_url( (int) $user_id = 0, (string) $scheme = 'admin' ); 

Returns (string)

Dashboard URL link with optional path appended.

Parameters (2)

0. $user_id — Optional. (int)
User ID. Defaults to current user.
1. $scheme — Optional. (string) => 'admin'
The scheme to use. Default is admin,, which obeys force_ssl_admin() and is_ssl(). http or https can be passed to force those schemes.

Usage

  1. if ( !function_exists( 'get_edit_profile_url' ) ) { 
  2. require_once ABSPATH . WPINC . '/link-template.php'; 
  3.  
  4. // Optional. User ID. Defaults to current user. 
  5. $user_id = -1; 
  6.  
  7. // Optional. The scheme to use. Default is 'admin', which obeys force_ssl_admin() 
  8. // and is_ssl(). 'http' or 'https' can be passed to force those schemes. 
  9. $scheme = 'admin'; 
  10.  
  11. // NOTICE! Understand what this does before running. 
  12. $result = get_edit_profile_url($user_id, $scheme); 
  13.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/link-template.php  
  1. function get_edit_profile_url( $user_id = 0, $scheme = 'admin' ) { 
  2. $user_id = $user_id ? (int) $user_id : get_current_user_id(); 
  3.  
  4. if ( is_user_admin() ) 
  5. $url = user_admin_url( 'profile.php', $scheme ); 
  6. elseif ( is_network_admin() ) 
  7. $url = network_admin_url( 'profile.php', $scheme ); 
  8. else 
  9. $url = get_dashboard_url( $user_id, 'profile.php', $scheme ); 
  10.  
  11. /** 
  12. * Filters the URL for a user's profile editor. 
  13. * @since 3.1.0 
  14. * @param string $url The complete URL including scheme and path. 
  15. * @param int $user_id The user ID. 
  16. * @param string $scheme Scheme to give the URL context. Accepts 'http', 'https', 'login',  
  17. * 'login_post', 'admin', 'relative' or null. 
  18. */ 
  19. return apply_filters( 'edit_profile_url', $url, $user_id, $scheme);