Redirect on login to My Account instead of homepage

If I currently login to the site from the homepage, I get redirected back to the homepage. Is there a way it can redirect to the My Account page instead?

Unfortunately there’s no easy way to do this because this would break other workflows, currently if the user tries to view some pages where logging in is required or perform actions the form always proceeds with the intended redirect or action. I can provide a code snippet to set a static redirect to My Account but for the home page only, let me know if this works for you (in this case it will not break other workflows, but may break some actions, for example user tries to send a message via the message icon in the listing card, but the page doesn’t refresh after login/registration to continue the action and will redirect user to the account page).

Yes, please provide that. I’ll have to explain to the client the overall complexities.

Use this code snippet to redirect to the user page when logging in from the home page.

	function( $form ) {

		if ( is_front_page() ) {
			$form['redirect'] = hivepress()->router->get_url( 'user_account_page' );

		return $form;
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.