How To Redirect BuddyPress Members After Login In WordPress?
How to redirect BuddyPress members after login: the login_redirect filter, BuddyPress 12 functions, role-based rules, plugin options and why redirects fail. Checked 15 Nov 2026.

To redirect BuddyPress members after login, hook WordPress’s own login_redirect filter and return the URL you want, or set a rule per role in a redirect plugin. On BuddyPress 12 and later, build the member profile URL with bp_members_get_user_url(), because the older bp_core_get_user_domain() is deprecated. We checked every function and hook below against the WordPress developer reference and the BuddyPress source on 15 November 2026.
The default behaviour is the problem this post solves. A member who logs in from wp-login.php with no redirect_to value lands on the WordPress dashboard, which means nothing to someone who joined to read an activity feed. Below you will find code for the destinations people ask for most (profile, activity, a group, a role-based landing page), a plugin route for people who would rather not touch PHP, and a list of the reasons a redirect silently stops working.
What is the quickest way to redirect BuddyPress members after login?
There are three routes, and the right one depends on how many rules you need and who maintains the site.
Route | Best for | Needs code | Handles per-role rules | Main limit |
|---|---|---|---|---|
A snippet on | One or two fixed rules, full control | Yes | Yes, if you write the branches | You own it when BuddyPress changes |
LoginWP (formerly Peter’s Login Redirect) | Rules by user, role or capability, with placeholders | No | Yes | Integrations with other plugins sit in the paid tier |
BuddyPress Redirect (WB Redirect, from our team) | Role-based login and logout destinations, BuddyPress profile as a target | No | Yes | Roles only, no per-user rules, no registration redirect |
If you only need “everyone goes to their profile”, the snippet in the next sections is about fifteen lines and has no dependency. If you have five roles and an editor who changes the rules every month, use a plugin. We explain both honestly further down, including where each one falls short.
How does the login_redirect filter work in WordPress?
The login_redirect filter runs inside wp-login.php just before WordPress sends the user on, and it receives three values: the URL WordPress intends to use, the URL that was requested through a redirect_to parameter, and the user. The developer reference documents the third value as a WP_User on success or a WP_Error when the login failed. Your callback has to handle both.
- $redirect_to is where WordPress will send the user if you change nothing. For a plain login with no request it is the admin URL.
- $requested_redirect_to is the raw
redirect_tovalue from the form or the link. It is an empty string for a plain login. - $user is a
WP_Userobject on success. Never read$user->rolesbefore you check it is aWP_User, or a failed login will throw a notice.
WordPress sends the result through wp_safe_redirect(), which only allows hosts on an allow list. Your own domain always passes. A redirect to another domain is replaced with the admin URL unless you add that host with the allowed_redirect_hosts filter. That matters if your community lives on a subdomain or a separate app domain.
One design choice shapes everything else: do you respect redirect_to or override it? A member who clicked a link to a members-only page and got bounced to the login form expects to land on that page afterwards. Respecting redirect_to keeps that working. The catch, covered in the troubleshooting section, is that several login forms add redirect_to automatically, so your rule never fires. The snippets below respect it by default and show you the one line to change.
How do I redirect BuddyPress members to their profile after login?
Return the member’s profile URL from login_redirect. On BuddyPress 12.0 and later the supported function is bp_members_get_user_url( $user_id, $path_chunks ). The BuddyPress 12 release moved member URLs onto the new rewrites system, and bp_core_get_user_domain() is marked deprecated since 12.0.0 in the source. The helper below uses the new function and falls back to the old one for sites still on BuddyPress 11 or earlier, so one snippet works on both.
Checked on 15 Nov 2026: the function names and arguments below match the BuddyPress 14.x source and the WordPress filter reference.
<?php
/**
* Build a member URL on any BuddyPress version.
* Checked on 15 Nov 2026 against the BuddyPress 14.x source.
*
* @param int $user_id The member.
* @param string $component Optional component slug, for example the activity slug.
* @return string URL or an empty string.
*/
function bpcd_member_url( $user_id, $component = '' ) {
// BuddyPress 12.0 and later.
if ( function_exists( 'bp_members_get_user_url' ) ) {
$chunks = $component ? array( 'single_item_component' => $component ) : array();
return bp_members_get_user_url( $user_id, $chunks );
}
// BuddyPress before 12.0 (deprecated since 12.0.0).
if ( function_exists( 'bp_core_get_user_domain' ) ) {
return bp_core_get_user_domain( $user_id ) . ( $component ? trailingslashit( $component ) : '' );
}
return '';
}
add_filter( 'login_redirect', 'bpcd_login_to_profile', 20, 3 );
function bpcd_login_to_profile( $redirect_to, $requested_redirect_to, $user ) {
// A failed login passes a WP_Error, not a user.
if ( ! $user instanceof WP_User ) {
return $redirect_to;
}
// Respect an explicit ?redirect_to=. Remove this check to always override it.
if ( ! empty( $requested_redirect_to ) ) {
return $redirect_to;
}
$url = bpcd_member_url( $user->ID );
return $url ? $url : $redirect_to;
}Put this in a small custom plugin or your child theme’s functions.php. A custom plugin is the safer home, because a theme switch would otherwise remove your login behaviour without any warning. The priority of 20 runs your callback after the default priority, which matters when another plugin also hooks the filter.
Two details are worth knowing. First, bp_members_get_user_url() returns an empty string when the member has no slug, so the fallback to $redirect_to is not decoration. Second, the URL honours your Settings > URLs choices and the permalink structure, so you never hard-code /members/.
How do I send members to their own activity page?
Use the same helper and pass the activity component slug as the second argument. bp_get_activity_slug() returns that slug, and the single_item_component path chunk is how bp_members_get_user_url() appends a component to the member URL. Check bp_is_active( 'activity' ) first, because a site can run BuddyPress with the Activity component turned off.
add_filter( 'login_redirect', 'bpcd_login_to_activity', 20, 3 );
function bpcd_login_to_activity( $redirect_to, $requested_redirect_to, $user ) {
if ( ! $user instanceof WP_User || ! empty( $requested_redirect_to ) ) {
return $redirect_to;
}
if ( ! function_exists( 'bp_is_active' ) || ! bp_is_active( 'activity' ) ) {
return $redirect_to;
}
$url = bpcd_member_url( $user->ID, bp_get_activity_slug() );
return $url ? $url : $redirect_to;
}We could not run this against a live BuddyPress 14 site while writing this refresh, so open the URL it produces once on your own site before you rely on it. If you changed the Activity slug in Settings > URLs, confirm the member-level link still resolves, and fall back to the profile URL if it does not.
What about the site-wide activity feed instead?
If you want the community feed rather than the member’s own page, return the activity directory URL. bp_get_activity_directory_permalink() exists in current BuddyPress and returns the address of the activity directory page. It is the closest match to “land on the news feed” for a social-style community.
// Inside the same callback, instead of the member URL:
if ( function_exists( 'bp_is_active' ) && bp_is_active( 'activity' ) ) {
return bp_get_activity_directory_permalink();
}How do I redirect members to a specific BuddyPress group?
Send members to the group page only when they actually belong to it, and send everyone else to the profile. groups_is_user_member( $user_id, $group_id ) returns the membership ID when the user is a member and false otherwise. For the group URL, BuddyPress 12 added bp_get_group_url( $group ), which takes a group ID or object. The older bp_get_group_permalink() is deprecated since 12.0.0 and expects a group object.
add_filter( 'login_redirect', 'bpcd_login_to_group', 20, 3 );
function bpcd_login_to_group( $redirect_to, $requested_redirect_to, $user ) {
if ( ! $user instanceof WP_User || ! empty( $requested_redirect_to ) ) {
return $redirect_to;
}
if ( ! function_exists( 'bp_is_active' ) || ! bp_is_active( 'groups' ) ) {
return $redirect_to;
}
$group_id = 12; // Change to your group's ID (Groups screen in wp-admin).
if ( groups_is_user_member( $user->ID, $group_id ) ) {
// BuddyPress 12.0 and later, with a fallback for older versions.
if ( function_exists( 'bp_get_group_url' ) ) {
return bp_get_group_url( $group_id );
}
return bp_get_group_permalink( groups_get_group( $group_id ) );
}
// Not a member: fall back to the profile.
$url = bpcd_member_url( $user->ID );
return $url ? $url : $redirect_to;
}This pattern suits a course cohort, a paid members’ circle or an onboarding group. It does not pick “the most active group” for each member. That would need a query per login, which is a poor trade on a large site, so we keep it to one named group.
How do I redirect BuddyPress members by role?
Read the roles from $user->roles and return a different URL per role, checking the most important role first. A user can hold more than one role, so the order of your checks decides who wins. Administrators usually keep the dashboard, and everyone else gets a front-end destination.
add_filter( 'login_redirect', 'bpcd_login_by_role', 20, 3 );
function bpcd_login_by_role( $redirect_to, $requested_redirect_to, $user ) {
if ( ! $user instanceof WP_User || ! empty( $requested_redirect_to ) ) {
return $redirect_to;
}
$roles = (array) $user->roles;
// Order matters: first match wins.
if ( in_array( 'administrator', $roles, true ) ) {
return admin_url();
}
if ( in_array( 'editor', $roles, true ) ) {
return admin_url( 'edit.php' );
}
if ( in_array( 'subscriber', $roles, true ) ) {
$url = bpcd_member_url( $user->ID );
return $url ? $url : $redirect_to;
}
return $redirect_to;
}Custom roles from a membership or LMS plugin work the same way, using the role slug the plugin registers. Look the slug up under Users in wp-admin or with wp role list before you type it in, because the display name and the slug often differ.
Can I redirect by BuddyPress member type?
Yes. bp_get_member_type( $user_id, true ) returns the member’s type as a string, or false when none is set. Swap it in for the role check when your community separates, for example, “mentor” and “student” through member types rather than WordPress roles.
$type = function_exists( 'bp_get_member_type' ) ? bp_get_member_type( $user->ID, true ) : false;
if ( 'mentor' === $type ) {
return home_url( '/mentor-dashboard/' );
}What changed in BuddyPress 12 that affects login redirects?
BuddyPress 12.0 rebuilt how it generates and parses URLs (the BP Rewrites work). For login redirects, the practical effects are small but real, and they are the first place to look when an old snippet stops working.
- Member URLs have a new function.
bp_members_get_user_url( $user_id, $path_chunks )replacesbp_core_get_user_domain(), which is deprecated since 12.0.0. The new function takes only a user ID and an optional array describing the component, action and variables. - Group URLs too.
bp_get_group_url()replacesbp_get_group_permalink(), deprecated since 12.0.0. - The logged-in user has a helper.
bp_loggedin_user_url()arrived in 12.0.0 and is handy on pages where the user is already logged in. It is no use insidelogin_redirect, because the user is not yet the current user at that point, so keep passing$user->IDexplicitly. - Directory URLs are unchanged for our purposes.
bp_get_activity_directory_permalink()is still present in the activity template functions.
None of this removes the old functions yet, which is why many sites have not noticed. Deprecated code keeps working, and it logs a notice when WP_DEBUG is on. We recommend moving now, since a deprecation notice is the only warning you will get before removal.
How do I send new members to a welcome page on their first login?
Store a flag in user meta the first time the member logs in, and branch on it. This is a snippet-level task that the free per-role plugins do not cover, which is the main reason people reach for LoginWP Pro. It needs only core functions: get_user_meta() and update_user_meta().
add_filter( 'login_redirect', 'bpcd_first_login_welcome', 30, 3 );
function bpcd_first_login_welcome( $redirect_to, $requested_redirect_to, $user ) {
if ( ! $user instanceof WP_User || ! empty( $requested_redirect_to ) ) {
return $redirect_to;
}
// Checked on 15 Nov 2026: get_user_meta() and update_user_meta() are WordPress core.
if ( ! get_user_meta( $user->ID, 'bpcd_has_logged_in', true ) ) {
update_user_meta( $user->ID, 'bpcd_has_logged_in', 1 );
return home_url( '/welcome/' ); // Change to your welcome page.
}
return $redirect_to;
}Run this at priority 30 so it fires after the role and profile callbacks at priority 20 and can override them on the first login only. Existing members have no flag, so they would all see the welcome page once. If that is not what you want, set the flag for current users in one pass with wp user meta add or a one-off script before you ship the snippet.
Where should the redirect code live?
Put it in a small plugin of your own, not in the theme. A login rule is site behaviour, and a theme switch or a child theme mistake would remove it without any visible error. One file in wp-content/plugins/ with a plugin header is enough. Keep the helper and the callbacks together, prefix every function name (we used bpcd_) so nothing collides with another plugin, and note the BuddyPress version you tested against in a comment so the next developer knows when to re-check.
If several people manage the site, document which entry points your rule covers. The most common support question we hear after a redirect launches is “why does the WooCommerce page behave differently”, and a two-line note in the plugin file answers it before anyone asks.
Is there a plugin that redirects BuddyPress members after login?
Yes, and for most site owners a plugin is the better answer. You get a settings screen, no PHP to maintain, and someone else tracks BuddyPress changes. We checked two options on 15 November 2026. Figures come from the WordPress.org plugin directory and the vendor pages.
LoginWP (formerly Peter’s Login Redirect) | BuddyPress Redirect (WB Redirect) | |
|---|---|---|
Rule types | User, role, capability, and a blanket rule | A default plus one rule per role |
Login and logout | Login, logout and post-registration URLs | Login and logout, not registration |
BuddyPress profile target | A custom URL with the | Built-in dropdown option when BuddyPress is active |
Price | Free lite version, paid Pro for integrations | Free, no paid edition |
WordPress.org rating | 96% from 503 reviews | Not listed on WordPress.org; distributed from our own site |
Active installs | 80,000+ | Not published |
Last updated | 11 September 2026, tested to WordPress 7.0.8 | Version 2.2.0, March 2026 |
What users say about LoginWP
The WordPress.org page shows 503 reviews, 471 of them five-star, with an average of 4.8 (checked 15 November 2026, reviews page). The reviews from the last few months are short and positive (“works great”, “very handy”), so there is little detail to paraphrase. The complaints are older than two years. They concern features that need a paid subscription, advertising and upgrade notices inside the admin, and one report of a conflict with an Avada site. Support threads are thin as a measure: the plugin API lists one thread, resolved. The plugin’s own description confirms that WooCommerce, MemberPress, Paid Memberships Pro, Ultimate Member and BuddyBoss form support sits in Pro, and it does not list BuddyPress itself among those integrations, so test the lite version against your own login form first.
What we say about our own BuddyPress Redirect add-on
We build BuddyPress Redirect (WB Redirect), so weigh this as a vendor view. It is free with no paid edition, and per its product page it works on plain WordPress, adding a BuddyPress profile destination when BuddyPress is active, along with WooCommerce My Account, bbPress, Dokan, LearnDash and PeepSo destinations. It sets one default plus one rule per role, for login and for logout. The honest limits: rules are per role only, so you cannot send one named member somewhere special. It does not act on registration, and its product page lists no placeholders or conditional logic. If you need “first login goes to the welcome page”, use LoginWP Pro or a snippet. BuddyPress add-ons from us get maintenance and compatibility updates, and we are not promising new features for them.
Why is my BuddyPress login redirect not working?
In almost every case something else sets the final redirect after yours, or the login never goes through wp-login.php. Work through the list in this order. It takes about ten minutes and saves hours of guessing.
A WooCommerce login form uses its own filter
The WooCommerce My Account login form handles the login itself rather than through wp-login.php, so login_redirect does not run there. WooCommerce applies its own woocommerce_login_redirect filter, with the redirect and the user as arguments, and then sends the visitor on. Add a callback to that filter as well if customers log in on that page:
add_filter( 'woocommerce_login_redirect', 'bpcd_woo_login_to_profile', 20, 2 );
function bpcd_woo_login_to_profile( $redirect, $user ) {
if ( $user instanceof WP_User ) {
$url = bpcd_member_url( $user->ID );
if ( $url ) {
return $url;
}
}
return $redirect;
}Checked on 15 Nov 2026 against the WooCommerce form handler on GitHub. Reuse the bpcd_member_url() helper from earlier in this post.
A theme or membership plugin passes redirect_to
Login widgets, modal login forms and many membership plugins add the current page as redirect_to. If you respect that value, your rule is skipped; if you override it, members lose the “take me back where I was” behaviour. Pick one on purpose. A reasonable middle path: override only when $requested_redirect_to is empty or points at wp-admin, and respect it otherwise.
Single sign-on and social login sit in the middle
SSO and social login plugins often finish the login through their own callback URL and set their own destination, so login_redirect may never run for those members. Check the plugin’s settings for a post-login URL field and set it there. Our guide to social login plugins covers what each type of plugin tends to do after the login completes.
A profile-completion or onboarding redirect runs later
Plugins that force members to finish their profile have been reported to take priority over login redirects (see the mistakes list below). That is the plugin doing its job, not a bug in your snippet. Check the plugin’s own setting that controls when the forced redirect applies, and test with a member whose profile is complete.
Caching, priority and the allowed-host check
Page caches can serve a logged-out copy of the page you redirected to, which looks like a failed redirect. Exclude the login and profile URLs from full-page caching, or test in a private window. If two callbacks use the same priority, the one registered last wins, so raise yours to 99 while debugging. And remember wp_safe_redirect(): a destination on another domain is dropped unless you allow it with allowed_redirect_hosts.
What are the common mistakes people report?
These come from public forum threads and the BuddyPress source, not from our imagination. We link each one and give its date, because older threads may describe versions you no longer run. Checked 15 November 2026.
- WooCommerce overrides the profile redirect. A site owner on the BuddyPress.org forum (2020) found that the
/meaddress landed on the WooCommerce My Account page. A second poster in the same thread eventually traced their problem to a Profile Builder option that redirects users with incomplete required fields. - WooCommerce and Dokan use a different filter. On a BuddyDev support thread (February 2019) the plugin author suspected that WooCommerce and Dokan use a different login filter or attach a late callback. This is why the
woocommerce_login_redirectsnippet above exists. - Profile-completion plugins beat login redirects. A BuddyDev forum report (March 2021) tested several redirect plugins, including Peter’s Login Redirect and our BuddyPress Redirect add-on, and found that a profile-completion redirect took priority over all of them.
- Old snippets call deprecated functions. Many tutorials still use
bp_core_get_user_domain(). The BuddyPress source marks it deprecated since 12.0.0 in favour ofbp_members_get_user_url(), as the members functions file on GitHub shows. It still works for now, but it will not stay forever. - Abandoned redirect plugins. The “BP Login Redirect” plugin on WordPress.org was last updated in January 2015 and its 1-star reviews describe fatal errors and a locked-out admin. Check the last-updated date before you install anything for login handling.
How do I redirect members after logout or registration?
WordPress has matching filters. logout_redirect receives the same three values as login_redirect and controls where people land after logging out. registration_redirect receives the requested URL and any errors and controls where new users go after signing up. Both exist in wp-login.php in current WordPress. Note that BuddyPress has its own registration screen, so a redirect after BuddyPress sign-up may need a separate hook from the one in wp-login.php. Treat it as its own task, and test it with a real registration before you trust it.
How do I test a login redirect properly?
Test as a real member, not as the administrator who wrote the code. Use these steps every time you change a rule:
- Create one test user per role you handle, plus one with no special role.
- Log in from each entry point you have:
wp-login.php, the theme’s login modal, the WooCommerce My Account page and any membership form. - Open a protected page while logged out, log in from the redirect, and confirm you return to that page if you chose to respect
redirect_to. - Try a wrong password. You should see the normal error, not a PHP notice, which confirms your
WP_Usercheck. - Repeat in a private window with caching on.
Turn on WP_DEBUG on a staging copy while you test. A deprecation notice from bp_core_get_user_domain() on BuddyPress 12 or later is your cue to switch to the new function.
Which option do we suggest?
Match the tool to the situation, not to the length of the feature list.
- One rule, no budget for plugins: the profile snippet in this post. It is short, has no dependency and works across BuddyPress 11 and 12+.
- Several roles, a non-technical editor: a plugin. LoginWP gives you user, role and capability rules plus placeholders. Our BuddyPress Redirect add-on gives you a simpler per-role screen with BuddyPress profiles as a destination. Pick LoginWP if you need rules per user or capability, and the add-on if per-role is all you need.
- WooCommerce customers who also join the community: use the
woocommerce_login_redirectsnippet or a plugin that explicitly supports WooCommerce. Do not assume the BuddyPress rule will cover that form. - Starting a new community: look at the themes and platform too. Our team builds the BuddyX and Reign themes, and BuddyNext as a newer community platform. They fit when you want a front-end login and member area designed together. Their real downsides: they are themes and a platform, not a redirect fix, and BuddyNext is a different codebase from BuddyPress, so the BuddyPress function names in this post do not apply to it.
If you are weighing the wider setup, these related guides from our team may help: how to use the BuddyPress plugin, WordPress plugins for membership sites, BuddyPress with MemberPress and Divi and adding member reviews to profiles.
Frequently asked questions
Can I redirect to a custom URL instead of a BuddyPress page?
Yes. Return any URL on your own domain from the callback, for example home_url( '/welcome/' ). For another domain, add its host through allowed_redirect_hosts first, or WordPress will ignore it.
Do I still need a plugin if I use the snippet?
No. The snippet covers a fixed set of rules. A plugin earns its place when non-developers need to change rules, or when you want first-login logic without writing it.
Will my redirect break when I update BuddyPress?
It can if you use deprecated functions. Using bp_members_get_user_url() with the fallback shown above protects you across BuddyPress 11 and 12+. Re-test after major BuddyPress updates, since 12.0 changed how member URLs are built.
Why does the redirect work for me but not for members?
You are probably logging in as an administrator from wp-login.php, while members log in from a theme modal or a WooCommerce form that sends redirect_to or uses another filter. Test with a member account from the same login form they use.
Can I send members to the page they were on before logging in?
Yes, and it is the default if you respect redirect_to. LoginWP Pro also offers a placeholder for the current and previous page, per its WordPress.org description.
Does this work on BuddyBoss or BuddyNext?
The login_redirect filter is WordPress core and applies everywhere. The BuddyPress function names do not carry over unchanged: BuddyBoss and BuddyNext are separate codebases, so check their own documentation for the right way to build a profile link before you reuse the helper.
Sources checked on 15 November 2026: the login_redirect reference, the wp_validate_redirect reference, the LoginWP plugin page and the BuddyPress source on GitHub.


