Site icon Denis Bouquet

MembershipWorks plugin, how to redirect to the current page on login

You can specify one page to redirect after login. Make this page the current page to provide a better experience for your visitors.

How to redirect to the current page on login with membership works

<?php if(is_user_logged_in()) { ?>
	<!-- content for logged users -->
<?php } else {
	// login form with redirect to the current page
	$redirect_login = "https://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"];
	echo apply_filters( 'the_content',' [mw open="myaccount" redirect="'.$redirect_login.'"] '); 
} ?>
Exit mobile version