Link to user’s profile settings page?

I’m trying to figure out how to link a logged-in user to his profile settings, but I can’t seem to find a function that generates this link (like wp_settings_url() or wp_profile_url())
Is there a default function for this?

Related posts

Leave a Reply

5 comments

  1. The user edit page of the current user is /wp-admin/profile.php, so you can just do admin_url( 'profile.php' ), which is the way it is used in the WP source code.

  2. Combination of other answers:

    <a href="<?php echo admin_url( 'user-edit.php?user_id=' . $curauth->ID, 'http' ); ?>">Edit Profile</a>
    

    I’m using this on author.php, that’s why I’ve already got the user ID on the page. That way an admin gets a link to edit that user’s profile rather than their own.

  3. Possibly something like this?

    <?php get_currentuserinfo();
    
    global $user_ID;
    if (” != $user_ID) { ?>
    
    <a href="/wp-admin/user-edit.php?user_id=<?php the_author_ID(); ?>">Edit
    Profile</a>
    
    <?php } ?>
    
  4. If you’re only interested in the current user, use get_edit_profile_url():

    <a href="<?php esc_attr_e( get_edit_profile_url() ); ?>">
        <?php esc_html_e( 'Link to your profile' ); ?>
    </a>
    

    If you want to display a link to another user’s profile, use get_edit_user_link():

    <?php
    $user = get_userdata( $user_id );
    if ( $user ):
        ?>
        <a href="<?php esc_attr_e( get_edit_user_link( $user->ID ) ); ?>">
            <?php esc_html_e( $user->user_login ); ?>
        </a>
        <?php
    endif;
    
  5. This is the Correct way! Please use this for user profile link.

    <?php echo admin_url( 'user-edit.php?user_id=' . $user_id, 'http' ); ?>"><?php echo ucwords( wpe_get_user_name( $user_id ) ); ?>