Redirect Specific link to a page for logged in users

I have a link in my WP website Account link.
I would like this will work normally for logged out users.
For Logged-in users i would like this link to take them to another page url.

I have tried:

function my_logged_in_redirect_sub() {
if ( is_user_logged_in() &&($_GET[‘account’] )
) {
wp_redirect( get_permalink( 15498 ) );//the redirect page id
die;
}
}

add_action( ‘template_redirect’, ‘my_logged_in_redirect_sub’ );

The $_GET[‘url’] doesn’t work

Question: How can i target a specific URL with PHP?

Read more here:: Redirect Specific link to a page for logged in users

Leave a Reply

Your email address will not be published. Required fields are marked *