I have a similar question as this but the solution isn't working like I wanted. So a little background. I have two custom template pages "login.php" and "welcome.php" and then I created two WP pages: Login page using login.php as template and Dashboard page using welcome.php as template page. Hence the structure is "http://example.com/login/" (using login.php as template) and "http://example.com/dashboard/" (using welcome.php as template). After successful login from the Login page, I want to move to the Dashboard using
ob_end_clean();
header("Location: http://example.com/dashboard/");
exit;
I also tried
ob_end_clean();
header("location: welcome.php");
exit;
However, after successful login, the login form on Login page just disappear but I am not directed to the Dashboard page so I can't do the login again as there is no elements showing on the the page. What could be causing this?
Side note: I get this warning
Warning: Cannot modify header information - headers already sent by (output started at /home/xxx/example.com/wp-includes/class.wp-styles.php:237) in /home/xxx/example.com/wp-content/themes/spacious/page-templates/login.php on line 32
It's a warning but I don't know if that is the cause of not getting directed to the Dashboard page. I had ensured there are no spaces in class.wp-styles.php
file between the opening and closing php tags.