How To Set Cookies to Zero Days for a WordPress Blog
If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
Uncomfortable with having your WordPress blog keep subscribers and editors signed in even after closing their browsers?
Here’s how to delete cookies from your WordPress blog. You’ll have to modify a file in the root directory of your WP installation.
Look for the file called wp-pass.php - it should contain php code like so:
require( dirname(__FILE__) . '/wp-config.php');
if ( get_magic_quotes_gpc() )
$_POST['post_password'] = stripslashes($_POST['post_password']);
// 10 days
setcookie('wp-postpass_' . COOKIEHASH, $_POST['post_password'], time() + 864000, COOKIEPATH);
wp_safe_redirect(wp_get_referer());
See that line that starts with setcookie?
All you have to do is change “864000″ to “0″ and the cookie drops from 864,000 seconds to zero seconds. So, the setcookie line should look like this:
setcookie('wp-postpass_' . COOKIEHASH, $_POST['post_password'], time() + 0, COOKIEPATH);
When the user closes their browser, the session is complete and the cookie is dropped. Users will have to log in again the next time they visit your blog.
[...] - bookmarked by 3 members originally found by ulcia307 on 2008-07-22 How To Set Cookies to Zero Days for a WordPress Blog http://computeraxe.com/how-to-set-cookies-zero-days-wordpress-blog/ - bookmarked by 1 members [...]