WordPress action hook · part of WordPress core
auth_cookie_bad_hash
A WordPress core action that 5 plugins also fire themselves, running on 40+ sites between them.
“Fires if a bad authentication cookie hash is encountered.”
How to use auth_cookie_bad_hash
It's an action: your callback runs at that point and receives 1 argument. Nothing needs to be returned.
Add this to your theme's functions.php or a small custom plugin:
add_action( 'auth_cookie_bad_hash', function( $cookie_elements ) {
// Your code runs here.
}, 10, 1 );Argument names come from WP Similar Basic Auth's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
This hook is fired by WordPress core too. Official reference on developer.wordpress.org →
5 plugins that fire auth_cookie_bad_hash
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
WP Similar Basic Auth10+ installs
do_action( 'auth_cookie_bad_hash', $cookie_elements )includes/class-cookie.php:225 -
Invalidate Logged Out Cookies10+ installs
do_action( 'auth_cookie_bad_hash', $cookie_elements )pluggable_overrides.php:51 -
Safe Cookies10+ installs
do_action( 'auth_cookie_bad_hash', $cookie_elements )safe_cookies.php:95 -
Safer Cookies10+ installs
do_action( 'auth_cookie_bad_hash', $cookie_elements )safer_cookies.php:150 -
Tattoo ImagesFewer than 10 installs
do_action( 'auth_cookie_bad_hash', $cookie_elements )wp-pluggable-for-gallery.php:121
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.