我试图在用户登录WP时设置cookie。
我使用wp_login钩子是这样的:
add_action('wp_login', array($this, 'knp_aci_login_check'), 1, 2);
和我的cookie函数:
public function knp_aci_login_check( $user_login, $user ) {
$contact = $this->request->api_connect('contacts?filters[email]='.$user_login, 'GET');
if (wp_remote_retrieve_response_code( $contact ) == 200) {
setcookie('ac-status', 'true', 365 * DAY_IN_SECONDS, '/', get_site_url());
}
}
我的Cookie, 永不保存。
#1
你是否尝试过在没有条件的情况下设置Cookie?也许不是setcookie, 但是if语句返回false。
来源:
https://www.srcmini02.com/63880.html
微信公众号
手机浏览(小程序)
Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(): Failed to enable crypto in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_37550.jpg): failed to open stream: operation failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57