Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
wp_logout example
setcookie
(
'wp-postpass_' . COOKIEHASH,
$hasher
->
HashPassword
(
wp_unslash
(
$_POST
[
'post_password'
]
)
)
,
$expire
, COOKIEPATH, COOKIE_DOMAIN,
$secure
)
;
wp_safe_redirect
(
wp_get_referer
(
)
)
;
exit
;
case
'logout':
check_admin_referer
(
'log-out'
)
;
$user
=
wp_get_current_user
(
)
;
wp_logout
(
)
;
if
(
!
empty
(
$_REQUEST
[
'redirect_to'
]
)
)
{
$redirect_to
=
$_REQUEST
[
'redirect_to'
]
;
$requested_redirect_to
=
$redirect_to
;
}
else
{
$redirect_to
=
add_query_arg
(
array
(
'loggedout' => 'true',
'wp_lang' =>
get_user_locale
(
$user
)
,
)
,
wp_login_url
(
)
)
;