How do you log a user out with wp_logout?

If you’re using wp_logout in your own code, its probably best to exit or wp_redirect immediately afterwards. You can call wp_set_current_user(0) after wp_logout() to manually log the user out instantly, if you need to continue executing PHP but don’t want the user to be logged in.

wp_logout_url isn’t forwarding to correct link

The issue is you pointing entirely unrelated (from WordPress point of view) domain to WP site. When WP processes logout the redirect is performed by wp_safe_redirect(), which disallows to redirect user “outside” the site. Since it has no clue about your custom domain that link is simply discarded. I would advise to properly set up … Read more

Getting User email on logout. wp_logout

wp_get_current_user() will never work in this hook, because, wp_logout action fires after user is logged out: session destroyed, cookies cleared and current user is set to 0. But wp_logout action recieves $user_id. I will give you a working example, because I do not familiar with your custom functions. //pass $user_id as argument function mmd_JudgeLogoutCheck($user_id) { … Read more

Ajax function returns -1

Rarst said it worked for him both logged in and logged out, i can also confirm the same, here’s my ugly test code that works, very much just a hacked together version of your code(for testing). function say_coucou(){ check_ajax_referer( ‘hello’, ‘nonce’ ); echo “Hello”; die; } add_action(‘wp_ajax_hello_hello’, ‘say_coucou’); add_action(‘wp_ajax_nopriv_hello_hello’, ‘say_coucou’); add_action(‘admin_print_footer_scripts’,’blabla’,20000); add_action(‘wp_head’,’enj’,20000); add_action(‘wp_footer’,’blabla’,20000); function enj() … Read more

add logout button on admin side menu

I’m using this as a custom logout button, it also displays a random quote before logout the user. I think you can adapt it to your needs by removing what you don’t need. Instructions: Copy the code below and save as users-logout.php Create a folder called users-logout, upload the file and the images below to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)