Browse: Home / Snippets /

Override ‘Edit profile’ link in ld_profile shortcode

Contents


Snippet #

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.example.com';
	}
	
	// If the current user has the edit_users capability (like an admin), let them easily access admin-side tools
	return $original_url;
} );