The post password cookie is set with:
setcookie(
'wp-postpass_' . COOKIEHASH,
$hasher->HashPassword( wp_unslash( $_POST['post_password'] ) ),
$expire,
COOKIEPATH,
COOKIE_DOMAIN,
$secure
);
in the wp-login.php
file.
We can then use the clear_auth_cookie
hook, in the wp_clear_auth_cookie()
function, to clear it on logout:
/**
* Clear the Post Password Cookie on logout.
*
* @link http://wordpress.stackexchange.com/a/198890/26350
*/
add_action( 'clear_auth_cookie', function()
{
setcookie(
'wp-postpass_' . COOKIEHASH,
'',
time() - YEAR_IN_SECONDS,
COOKIEPATH,
COOKIE_DOMAIN
);
});
Related Posts:
- How to delete Password Protected posts cookies when a user logged out from the site
- Security error WP 4.0 + WP phpBB Bridge [closed]
- Preventing BFA in WordPress without using a plugin
- Specific way to allow WordPress users to view their current password? And edit it?
- My WP site and password was hacked, what to do? [closed]
- How to resolve these findings from security audit
- Stop the user if login from the cookies
- Is Timthumb still broken? What security measures should be taken?
- Prevent direct access to WordPress plugin assets?
- Completely disabling password reset/recovery
- Is it safe to use admin-ajax.php in the frontend?
- How to protect WordPress from security scanner [closed]
- Too many login attempts
- Is there any pre-existing plugin to track and block IPs with suspicious activity on my site?
- How to prevent plugins from sniffing/stealing other plugins’ options?
- Website show Google Ads when we have no Google Ads linked to our website
- Vulnerability Concern From the Plugin or From Not Updating the Plugin?
- Custom API plugin to execute 3rd party API to retrieve data
- How to deal with Slow HTTP POST (slowloris) vulnerability
- Running multiple security plugins
- how do I secure my WP website from hackers? [closed]
- Displaying content based on drop-down menu selection sitewide
- Chrome Dev Tools console says every page in my blog has link to http://maps.google.com [closed]
- Blurry images when loading the page first time
- Webservice credential storage [duplicate]
- Plugin: connect to external database without showing password
- Regarding plugin security
- How do I determine if the user who registered is not spam?
- If I use an alternative login (e.g. CAS or other SSO) plugin, is my site protected from the recent brute force login attempts?
- Is this plugin safe to run?
- Is the Block Bad Queries Plugin Still Relevant?
- WP Insert Post If user refreshes override new post
- 404 errors when updating options in admin dashboard
- Website Captcha Error: The reCAPTCHA wasn’t entered correctly
- Hide plugins and theme from public
- Cookies set by a plugin in wordpress for tracking
- Codeless random token generation to pass into multiple tracking links in a single page load
- WordPress search shows protected content
- Security of a WordPress Plugin
- Can I disable xml-rpc by setting it to false?
- How can I disable new plugin and theme install, but allow updates?
- Help to Create a Simple Plugin to make a post
- Identify User Language, Redirect to the corresponding page and Save the chosen language as Cookie
- Create Woocommerce account password post-checkout on thank you page
- Validating ajax search
- Content-Security-Policy implementation with WordPress W3Total Cache plugin installed
- Cookie value changes back to previous value after changing
- Display value of the GET parameter in a new URL page
- WordPress disable direct access of files in WordPress installation path
- Asking help regarding potential malware
- Automatic chage password of pages after some time
- prevent anonymous access to WordPress site (non-admin site)
- Block Google tracking on refuse consent of the user with plugin
- wp_set_password() does not work!
- Login/password protected “client page”
- Bing/msn bots is heavily requesting random of my website
- WordPress Admin login redirect to homepage
- “Fire Secure” menu item
- Login issue in WordPress
- How to make a page both “private” and “password protected”
- Password Protect wp-content?
- Securing a plugin pop-up window
- https rewrite not working for All in one security Brute force > rename login url
- Members-only page, but accessible via sharable link
- How can I store user preferences in WordPress and retreive them later?
- Create password protected page, no registration
- WordPress delete cookie
- Cant visualize protected password portfolio elements
- Why does WordPress use cookies for /wp-admin and /wp-content/plugins for non-admin users [duplicate]
- Implementation to count page visits of unique visitors based on a cookie
- admin-ajax.php not working properly on subdomains
- Cookie set in a plugin visible in admin but not on front
- How can I save cookies to members
- Redux framework somehow added to my site, can’t locate in plugins
- Being hacked. Is there a list of WordPress security holes I can check against?
- wp_verify_nonce fails always
- How can i see/log all requests coming from a registration form (not from the UI)?
- Write mysql credentials in plugin
- Site is continuously accessing by several IPs
- Validating values using Settings API?
- using .htaccess only for wordpress security no plugins
- SWF in wordpress post
- set cookies for my whole site is not working
- Unwanted Links and Spam WordPress Pages and Posts
- How can I allow for the password protect feature to allow visitors to enter any number at all?
- Alter the reset password link
- Password Protected Directory Link Shows Maintenance Mode Page
- Problem with permissions in wp-content/plugins
- WordPress Plugin: Where should I put my cookies for cURL?
- Is it possible to send user new password after they clicking on forgot password in word press
- File permissions for wp-minify plugin
- What is the recommended way to be notified of security updates to my plugins? [closed]
- Undefined constant error in pluggable.php
- ERROR: Cookies are blocked due to unexpected output – no access to FTP
- How I can hide my wp folders from Inspect Element (Developer Tools)
- How to Find WordPress site has backdoor login Codes
- How to rename files during upload to a random string?
- WordPress User Registration/ Sign Up -> Able to take Paid Certification Courses & keep track of Completed Certificates
- Block Root REST API Route using custom &/or iThemes
- Is it a good idea to restrict the REST API