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.

HOWTO: Add Custom Classes to Post Navigation Links

Sometimes you just need to have a bit more control over the display of the post navigation (next_posts_link, previous_posts_link). You can easily add in your own custom classes by adding the code below to your theme’s functions.php file. In the example below – I added in a custom class “older” and “newer”. You can add in anything there you would like.

add_filter('next_posts_link_attributes', 'sdac_next_posts_link_attributes');
function sdac_next_posts_link_attributes(){
		return 'class="older"';
}

add_filter('previous_posts_link_attributes', 'sdac_previous_posts_link_attributes');
function sdac_previous_posts_link_attributes(){
		return 'class="newer"';
}