當我嘗試這個代碼不能使用wp_signon()
$creds = array('user_login' => $_POST['benutzername'], 'user_password' => $_POST['passwort'], 'remember' => true);
$user = wp_signon($creds, false);
if (is_wp_error($user)): echo $user->get_error_message(); endif;
wp_set_current_user($user->ID);
return $user;
我得到這個消息:
Warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/your-click.ch/httpdocs/wp-includes/formatting.php:4179) in /home/httpd/vhosts/your-click.ch/httpdocs/wp-includes/pluggable.php on line 925 Warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/your-click.ch/httpdocs/wp-includes/formatting.php:4179) in /home/httpd/vhosts/your-click.ch/httpdocs/wp-includes/pluggable.php on line 926 Warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/your-click.ch/httpdocs/wp-includes/formatting.php:4179) in /home/httpd/vhosts/your-click.ch/httpdocs/wp-includes/pluggable.php on line 927 Catchable fatal error: Object of class WP_User could not be converted to string in /home/httpd/vhosts/your-click.ch/httpdocs/wp-includes/shortcodes.php on line 286
我正在使用shortcode.php代碼。我的代碼有什麼問題?
謝謝你,成功了! –
不客氣。 –