if user logged in wordpress
Step 1: Log in to your WordPress dashboard.
Step 2: Navigate to the "Appearance" menu on the left side of the dashboard.
Step 3: Select the "Editor" option under the "Appearance" menu.
Step 4: Locate and click on the "functions.php" file in the right-hand side file list.
Step 5: Insert the following code snippet at the end of the "functions.php" file:
function redirect_logged_in_user() {
if ( is_user_logged_in() ) {
wp_redirect( 'https://your-redirect-url.com' ); // Replace with the desired redirect URL
exit;
}
}
add_action( 'template_redirect', 'redirect_logged_in_user' );
Step 6: Replace 'https://your-redirect-url.com'
with the URL where you want to redirect the logged-in users.
Step 7: Click the "Update File" button to save the changes.
Now, when a user logs in to your WordPress site, they will be automatically redirected to the specified URL.