redirect after user login
-
Resolved
I’m using wordpress 2.6 to manage a website for a novel I’ve written. I have it set up so that the main site is a static page instead of the default chronological list of posts.
I want to set up the site so that users are redirected to the main page after they log in. I don’t want them going to the dashboard or writing screen or profile screen. They should go straight to the site’s home page.
Unfortunately, I don’t write code as well as I write books! I searched the forums before I posted this question, and I found this:
<?php /* Plugin Name: Redirect user to front page Plugin URI: https://www.theblog.ca/wplogin-front-page Description: When a user logs in via wp-login directly, redirect them to the front page. Author: Peter Version: 1.0 Author URI: https://www.theblog.ca */ function redirect_to_front_page() { global $redirect_to; if (!isset($_GET['redirect_to'])) { $redirect_to = get_option('siteurl'); } } add_action('login_form', 'redirect_to_front_page'); ?>
It sounded like it was what I needed, but I couldn’t get it to work. I put my site url in the right place, but i got a blank screen when I activated it and tried it.
Does anyone have any suggestions ?
- The topic ‘redirect after user login’ is closed to new replies.