Are you looking for a way to enable fancy user profile url like https://example.com/user-nice-name instead of the default profile url https://example.com/members/user-nice-name offered by BuddyPress? If yes, this is your day!
By default, BuddyPress offers user profile urls which appear as sub pages of members directory. If you need a fancy url for the user profile where members directory is not part of the user profile url, You can enable Root profile in BuddyPress.
Yes, you heard that correctly! If you need fancy user profile url like twitter, facebook, instagram etc where the user profile url consists of the siteurl and username( eg. https://example.come/user-nice-name/), you can achieve that with BuddyPress by enabling root profile. BuddyPress root profile makes the user profile url appear as direct sub page of the site directly instead of the members directory.
How to enable it?
To enable BuddyPress root profile, Please add the following code in wp-content/plugins/ bp-custom.php file.
define( 'BP_ENABLE_ROOT_PROFILES', true );
If you do not know what is bp-custom.php, Please take a look at https://buddydev.com/docs/buddypress-guides/what-is-bp-custom-php/
Here is a screenshot showing BuddyPress user profile url before enabling root profile:-
Here is a screenshot showing BuddyPress user profile url after enabling root profile:-
Enabling root profiles might have side effect. If some of your page has same slug as a user's nice name, it will cause conflict. Please do remember this while enabling the root profile.
Have a happy social networking experience with BuddyPress!