redirect login to Profile edit page
-
i try to login page redirect to profile edit page using
function redirect_to_user_profile_edit_page() { // Check if the user is logged in if (is_user_logged_in()) { // Check if BuddyPress is active if (function_exists('bp_is_active')) { // Get the current user's username $current_user = wp_get_current_user(); $username = $current_user->user_login; // Construct the profile edit page URL $profile_edit_url = home_url("/members/{$username}/profile/edit/group/1/"); // Check if the current page is not already the profile edit page if (!bp_is_current_component('profile') || !bp_is_current_action('edit')) { // Redirect the user to their profile edit page wp_redirect($profile_edit_url); exit; } } } } add_action('init', 'redirect_to_user_profile_edit_page');but all page url is redirect to profile edit page need to only login page redirect to this url
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘redirect login to Profile edit page’ is closed to new replies.