I am using the wp_signon () function to login the user. I am doing this
After logging in, I want to send the user to the home page. But I am experiencing the following error: WARNING: Header information can not be modified - Headers that have already been sent (e: \ xampp \ htdocs In the \ wpmoodle \ wp-content \ themes \ veten \ header.php: 12) e: \ xampp \ htdocs \ wpmoodle \ wp -include \ pluggable.php This is because Therefore, because However, the error indicates that you have already sent some output - 12 It basically indicates that you need to move your $ creds = array ();
$ creds ['user_login'] = $ username;
$ creds ['user_password'] = $ password;
$ creds ['remember'] = true;
$ user = wp_signon ($ creds, false);
wp_signon () code> needs to be run before sending any of your actual pages in the browser.
wp_signon () does what your authentication cookies sets by outputting a "set cookie": ... ... header - if You see the 690 line of
pluggable.php , where your error occurs, you will see that the line set is a cookie.
wp_signon () output header , you can not already send content - because the header There should always be output before the content.
header.php , possibly the first HTML of some standard WordPress themes.
wp_signon () somewhere in wordpress processing, so this is an opportunity to get the contents of any page Produce its header before sending it.
Comments
Post a Comment