Customize ‘Edit My Profile’ URL in WordPress Admin Bar

Customize ‘Edit My Profile’ URL in WordPress Admin Bar

A lot of sites have custom profile pages (not the general one you find in the WordPress admin > Users > Your Profile/Edit My Profile).profile After building an awesome edit profile page – your users log in, see the WordPress admin bar, click “Edit My Profile” and they end up at the WordPress general edit profile – not the one you want.

No worries – you can easily customize the URL in the WordPress Admin by adding the following code to your theme’s functions.php file:

/**
 * Customize Edit Profile URL in WordPress Admin Bar
 * @param string $scheme The scheme to use. Default is 'admin'. 'http' or 'https' can be passed to force those schemes.
*/
add_filter( 'edit_profile_url', 'sdac_custom_profile_url', 10, 3 );
function sdac_custom_profile_url( $url, $user_id, $scheme ) {
    $url = site_url( '/edit-profile' );
    return $url;
}

Note: Where I have ‘/edit-profile’ – you would just need to put in the page slug of your custom edit profile page. Once that is in place – log in your site and see the URL in the Admin bar now goes to your custom page.

Leave a Reply

Your email address will not be published.
*
*

This site uses Akismet to reduce spam. Learn how your comment data is processed.