Are you looking to check the user Logged In, to show a message or redirect to any other page? Then here we have a solution. With a simple IF condition, you can check the user where they logged or not. By using this condition you can display the message or redirect any other page in your WordPress website.
Display Message If User is Logged In
Based on user Logged In, you can display the message using the below code.
echo'Welcome, you are Logged In';
echo'You are not Logged In';
Redirect If User is Logged In
If you like to redirect to Home or Login page based on the user Logged In, you can using the below code.
header('Location: https://www.softaox.com/');// Redirect to Home or Any other Page
header('Location: https://www.softaox.com/login/');// Redirect to LogIn Page
I hope this will help you to check If User Logged In either you can display a message or redirect. If you have any doubts let me know in the comment section and if you like this article share it with your friends.
Creative Designer & Developer specialist by the spirit and a loving blogger by thoughts. If you have any questions let me drop an email with the article name to the following email id: [email protected]