Introduction
By default, BuddyBoss redirect snippets usually exclude administrators and send them to the WordPress dashboard after login. If you want all users, including admins, to be redirected to their BuddyBoss profile page after logging in, you can achieve this with a custom function. This guide explains how you can redirect all users to the profile page after login (Including Admins)
Custom Workaround
Before proceeding, make sure you have a complete site backup.
- Go to Appearance > Theme Editor in your WordPress admin dashboard.
- Under Select theme to edit, choose your active theme (preferably BuddyBoss Child Theme), then click Select.
- From the Theme Files list, click Theme Functions (functions.php).
- Paste the following code just before the closing PHP tag (?>):
function redirect_to_profile( $redirect_to_calculated, $redirect_url_specified, $user ) {
if ( ! $user || is_wp_error( $user ) ) {
return $redirect_to_calculated;
}
// If the redirect is not specified, assume it to be dashboard
if ( empty( $redirect_to_calculated ) ) {
$redirect_to_calculated = admin_url();
}
// Redirect all users (including admins) to their BuddyBoss profile
if ( function_exists( 'bp_core_get_user_domain' ) ) {
return bp_core_get_user_domain( $user->ID ) . '/activity/';
}
return $redirect_to_calculated;
}
add_filter( 'login_redirect', 'redirect_to_profile', 100, 3 );
- Click Update File to save your changes.
Troubleshooting and FAQs
Q: Admins are still redirected to the WordPress dashboard.
A: Make sure the code is added to the active theme’s functions.php and that no other login redirect plugins or custom code are overriding it.
Q: Can I redirect users to a different profile tab instead of Activity?
A: Yes. Replace /activity/ with another profile tab slug, such as /profile/ or /notifications/.
Q: Will this affect users logging in via AJAX or REST requests?
A: No. This redirect applies only to standard login redirects.
Q: Can I revert this behavior easily?
A: Yes. Remove the code from functions.php and save the file.
Q: Who can I contact for further assistance?
A: Please review the BuddyBoss Support Policy or consult a developer.