On button click, redirect users to registration page instead of another page

Question

I have a button that I have that leads users to a page on WordPress called /portfolio/, so is there a way that I can redirect users to the /registration/ page until their logged in?

I’m using a plugin on WordPress that uses the below code to change the menu per user logged in/logged out.

function my_wp_nav_menu_args( $args = '' ) {

if( is_user_logged_in() ) { 
    $args['menu'] = 'logged-in';
} else { 
    $args['menu'] = 'logged-out';
} 
    return $args;
}
add_filter( 'wp_nav_menu_args', 'my_wp_nav_menu_args' );

Is there a way that I can use the if( is_user_logged_in() ) to do the same with a redirect? I can’t seem to lock the page down to all users.

0
SLE 2 years 2020-10-24T01:10:26-05:00 0 Answers 7 views 0

Leave an answer

Browse
Browse