How To Set Cookies to Zero Days for a WordPress Blog

Posted on 16 July 2008 by LizzyFin

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.

Settings for Comments on WordPress Blogs

Posted on 14 July 2008 by LizzyFin

As you have probably gathered by now all parts of your WordPress blog are under your control. Every feature can be customized to your liking, from the theme that you use to the behind-the-screen settings for managing a WordPress blog.

Comments are managed according to the settings you choose by going to Settings/Discussion in the main menu.

The Discussion Settings page holds settings that help you manage comments left on your blog. Under ‘Default article settings’ checking off all three boxes will allow traffic to flow between your blog and the blogs of your commenters. Uncheck “Allow people to post comments on the article” if you aren’t interested in comments appearing on your blog.

wordpress comments settings discussion

You can choose to be emailed whenever anyone posts a comment or when one is held for moderation.

You can control when a comment appears on your blog in the ‘Before a comment appears’ section. You can limit comments to only the ones that you approve first, only if the commenter leaves her name and email address, or only after a prior comment has already been approved from that commenter.

If you’re bothered by a nuisance commenter, you can reject the comments from appearing altogether by using the ‘Comment Moderation’ or ‘Comment Blacklist’ features.

wordpress comments blacklist

Input words that you find offensive in either the moderation or blacklist boxes and any comment in which the content, name, URL or e-mail contains these bad words will be marked for moderation or marked as spam.

To reject comments coming from a particular IP address, place the IP on your blacklist.

Spam comments do make it through the Akismet plugin, but they are pretty easy to spot. Spam comments usually try to sell you pharmaceuticals or other stuff you don’t want. Their content is often filled with links to sites of questionable quality, so don’t go there! Email addresses that a person would never choose are the norm, so if you see something like “asdfkjl;@tk5jj6.cn” for an email address, mark the comment as spam.

wordpress comments avatars

The Avatar section lets you control whether you allow avatars to show up next to a person’s comment. Avatars are those little pictures that represent people and their interests. Some commenters use their photos and others use interesting pictures or abstract designs for their avatars.

Also, you can set the audience rating in the Avatar section. The same as movie ratings, you can rate your content for G-, PG-, R- or X-rated audiences.

Remember, any changes you make to the Discussion Settings page will not stick unless you click on the Save Changes button at the bottom of the page.

Managing Comments on Your WordPress Blog

Posted on 12 July 2008 by LizzyFin

One thing that separates a blog from just another Web site is that blogs have a commenting capability that engages your readers to talk back. Allowing readers to leave comments on your blog will can start a conversation of sorts. Web sites that aren’t in a blogging format must rely on forms and email for communication with the webmaster.

Blogs - remember that blog stands for Web log - typically report information through time. Posts are created and stamped with the time and date when they’re posted. Anyone reading a blog post may be able to comment on the post, depending on the settings of that particular blog or post.

WordPress blogs allow for comments, too. Whenever someone leaves a comment on your blog, WordPress alerts you with a little flag at the top of your WordPress Dashboard. Check it out:

wordpress comments screen

Click on the Comments menu item or on See All in the ‘Recent Comments’ section of the Dashboard to get to the manage comments screen.

wordpress comments manage

The text of each comment is presented with information about the commenter, such as their website address, email and IP, which is just a numerical address of their computer on the Internet. Under the actual comment you’ll see the post or page where the comment was left and when your blog visitor left their comment.

To the right of each comment are three links that you can use to manage them. You can choose to accept the comment, mark it as spam, or delete it. If you have lots of comments to manage, use the bulk approval/mark as spam/delete buttons at the top of the comment list. Click on the little box next to Comment to select all the comments, then click on your selection to moderate the comments. Each little box to the left of a comment lets you select or unselect comments for moderation.

Further down the manage comments page you see the background color is different for comments that have already been approved.

wordpress comments approval

Once comments have been approved you still have a chance to unapprove them. See that the top right link has changed from Approve to Unapprove for a comment that has already been accepted.

Before you accept a questionable comment, visit the commenter’s website to get a better idea of their intentions. If it’s not related to your blog topic, then you might not want to accept the comment. Many people sprinkle comments in blogs everywhere so they can have links pointing back to their site in hopes that the search engines will rank their site higher.

You don’t have to approve any comments if you don’t want to, after all it’s your blog!