wp_clear_auth_cookie

Removes all of the cookies associated with authentication.

Description

wp_clear_auth_cookie(); 

Usage

  1. if ( !function_exists( 'wp_clear_auth_cookie' ) ) { 
  2. require_once ABSPATH . WPINC . '/pluggable.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wp_clear_auth_cookie(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/pluggable.php  
  1. function wp_clear_auth_cookie() { 
  2. /** 
  3. * Fires just before the authentication cookies are cleared. 
  4. * @since 2.7.0 
  5. */ 
  6.  
  7. /** This filter is documented in wp-includes/pluggable.php */ 
  8. if ( ! apply_filters( 'send_auth_cookies', true ) ) { 
  9. return; 
  10.  
  11. setcookie( LOGGED_IN_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN ); 
  12.  
  13. // Old cookies 
  14. setcookie( AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN ); 
  15. setcookie( AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN ); 
  16.  
  17. // Even older cookies 
  18. setcookie( USER_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN ); 
  19. setcookie( PASS_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN ); 
  20. setcookie( USER_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN ); 
  21. setcookie( PASS_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN );