• How can I do a custom redirect after login to a page that is not the home page and not the admin page? I have tried using 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');
    ?>

    but I cant change the siteurl to something like newdash.html or newdash.php, it gives me a blank page. I need to use this to send a user to a “more user friendly” dashboard (its what they want so I cant get around it) how can i do this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter EvanWatkins

    (@evanwatkins)

    I gave up on that idea and I am now using this…

    case 'login' :
    default:
    	if ( isset( $_REQUEST['redirect_to'] ) )
    		$redirect_to = $_REQUEST['redirect_to'];
    	else
    		//$redirect_to = 'wp-admin/';
    		$redirect_to = 'wp-admin/test.php';
    	$user = wp_signon();

    however it will not let me redirect to test.php (which is just a copy of profile.php) but it will let it go to profile.php. Why wont it go to test.php since they are the same?

    I did it changing the redirect_to value in wp-login.php page

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom login redirect’ is closed to new replies.