I'm building a custom login form and I've tried two methods:
For the former, I am able to correctly return the
WP_User object upon a successful authentication, but no cookies are set to signal to
is_user_logged_in() that the user is indeed logged in. I suppose I can set my own cookies but is there an easier way?
For the latter, I keep having the error
Cannot modify header information - headers already sent by.... I've tried calling the
wp_signon() function from the
<head>, the actual header, and in the page template. I see the same error regardless. I've looked online but I'm not seeing any solutions to this exact problem.
The specific error is pointing to line 7 of
Warning: Cannot modify header information - headers already sent by (output started at /srv/www/mysite/current/web/wp/wp-content/themes/mysite/base.php:7).
But looking right there, I don't see any issue (these are lines 4 - 10, line 7 is the doctype):
use Roots\Sage\Wrapper; ?> <!doctype html> <html <?php language_attributes(); ?>> <?php get_template_part('templates/head'); ?> <body <?php body_class(); ?>>
As per WP's own troubleshooting, I've checked that there are no extra spaces.
Regardless of how it's gone about, I just need to be able to log a user in with their credentials and have the ability to check their logged-in status to create a logged-in state on a website.