Hello @missveronicatv
I have created my code, It used to work but now its not working, if there’s any error. If I deactivate the edit form should redirect to author page. But its not redirecting to author page for subscriber roles.
add_filter('um_update_profile_redirect_after', 'um_update_profile_redirect_custom', 10, 3);
function um_update_profile_redirect_custom($url, $user_id, $args) {
// Check if the user has the capabilities of a "Subscriber"
if (user_can($user_id, 'read')) { // Adjust the capability as needed
// Get the form ID from $args
$current_form_id = isset($args['form_id']) ? (int) $args['form_id'] : 0;
// Define the redirection URLs for each form ID
$redirect_url_3636 = '/app/saved/';
$redirect_url_3723 = '/app/saved2/';
$redirect_url_5990 = '/app/saved3/';
$default_redirect_url = '/app/dashboard/';
// Check the form ID and set the appropriate redirection URL
if ($current_form_id == 3636) {
$redirect_url = $redirect_url_3636;
} elseif ($current_form_id == 3723) {
$redirect_url = $redirect_url_3723;
} elseif ($current_form_id == 5990) {
$redirect_url = $redirect_url_5990;
} else {
$redirect_url = $default_redirect_url;
}
// Use wp_redirect to perform the redirection
wp_redirect($redirect_url);
exit();
}
return $url; // If not a subscriber, return the original URL
}