Custom “Edit Profile” Link

Updated 5 months ago
by Dave Warfel

When using the LearnDash profile block (or shortcode), there is an “Edit Profile” link that appears beneath the user’s avatar. By default, this link takes the user to the backend of WordPress, to the WordPress profile page.

You can change where that link sends them and use a custom URL instead.

The following PHP snippet can be used to override the link and send the user to a custom URL of your choice. Replace https://www.learndash.com/ with the link to your own profile page.

add_filter( 'get_edit_user_link', function( $original_url ) {
	/**
	 * Not a LearnDash-specific snippet
	 * Could apply to any link output by calling this WordPress core function
	 *
	 * @link https://developer.wordpress.org/reference/functions/get_edit_user_link/
	*/
	
	// Check to see if user can edit_users, if not, return a different Edit Profile link
	if ( ! current_user_can( 'edit_users' ) ) {
	
		// Replace the below URL with your custom front-end "Edit Profile" page
		return 'https://www.learndash.com';
	}
	
	// If the current user has the edit_users capability (like an admin), let them easily access admin-side tools
	return $original_url;
} );

NOTE
If you’re using the Design Upgrade Pro for LearnDash plugin, this option is already available in the Customizer. You should use that option, as adding this code could interfere with code in the plugin.

All CSS code should either be placed in a child theme’s main CSS file (typically style.css), or the Additional CSS area of the WordPress Customizer.

How to Add CSS to Your Site

Forum Rules

Be Kind & Patient

We’re here to learn and/or help each other. Please don’t be mean, rude, or condescending. Treat all members the way you should be treating dogs and your elders—with the utmost love & respect.

External Links

✅ Other websites that add value, help solve problems & contribute to the discussion. ❌ Affiliate links are prohibited. (Site owners may use affiliate links to help support the site.)

Promotion

✅ You may promote your own products/services if they are relevant to an existing discussion. You must disclose your relationship with the product(s).
❌ You may not create new posts simply to promote your products.

Non-LearnDash Topics

❌ General (free) Forum: Only LearnDash-specific topics are allowed.
✅ Premium Forums: You are allowed to post other questions tangentially related to LearnDash. Please use the appropriately named forum. If it doesn’t exist, use the “LearnDash Integrations” forum.

Our Right to Remove

We reserve the right to remove any content, at any time, for any reason. We can also merge one post with another. We will exercise caution when removing content and always try to provide an explanation.