Archive for WordPress

How To Crush WordPress Trackback Spam

Since upgrading to WordPress 2.3.2, the webserver that hosts my blog has taken a beating from trackback spammers.

The trackback requests were prevalent before, but for some reason they weren’t slowing the server down until the upgrade.

After trying many solutions, I finally found a way to solve the problem. This will no longer allow you to have trackbacks on your blog, but if you have to decide between no blog or no trackbacks then I’m sure you’ll have no problem implementing this.

Basically you just update your index.php to the following:

if ( preg_match('/trackback/', $_SERVER['REQUEST_URI']) ) {
die();
} else {
/* Short and sweet */
define('WP_USE_THEMES', true);
require('./wp-blog-header.php');
}
?>

You might need to modify the preg_match() so that you don’t cut off legit posts that have trackback in the name, but the blog I use this code on does not have such posts.

Hopefully some day soon these spammers will realize they’re doing no one any good.

Does FeedBurner’s URL Tracking Cause Blogs to Inappropriately Appear Updated?

I’ve found a weird inconsistency with my Google homepage, and it appears to be created by RSS feeds that have FeedBurner’s URL tracking features turned on.

The problem I’m having is that of web usability.

From time to time, the links that appear as visited on my Google homepage (because I’ve visited them, of course) turn back to the non-visited color sometime later. This sucks, because I know I’ve visited the pages before, but I have to make sure I have read it first.

This creates major problems for someone like me with OCD (no, I don’t perform rituals).

The only common theme with all of the feeds that show this type behavior is that they all have FeedBurner’s URL tracking turned on.

I don’t use Google Reader or any other RSS reader, so I’m wondering if it’s just Google homepage, or if all RSS readers have this problem.

Has anyone else noticed this behavior on their Google homepage or other RSS reader? If you use FeedBurner URL tracking would you please turn it off?

Tags: , , , , , , ,

Show Unread Comments: Version 1.1

Ask and you shall receive: I’ve updated my Show Unread Comments WordPress plugin to incorporate a few suggestions from people just like you.

The first change made to the plugin is actually a bug fix. With the initial version, the statuses of comments on pages were not marked appropriately, and status indicators were not showing up next to comments on pages. This has been fixed, so you’ll now see comments being tracked properly on pages.

The next change made to the plugin is the most popular feature request: the ability to return a binary value with show_unread_comment_status().

Now all you have to do is pass bin for $type and you’ll be returned true if the comment has been read and false if the comment is unread. This should make dynamically updating CSS for read and unread comments a snap.

Make sure you visit the Show Unread Comments page to get all the intimate details.

If you’re in a hurry you can download the latest version of the plugin at:

http://www.ryanjparker.net/files/show-unread-comments.zip

I’ve still got one more feature I’d like to get implemented, and that’s for the ability to create a direct link to the oldest unread comment when you’re viewing a given post or page, so if you’ve got any other feature requests or find a bug make sure you comment below or contact me so I can make sure to include it in the next version!

Tags: , , , ,

Separating Pingbacks and Trackbacks from Comments in Wordpress

This isn’t something blogs do all that often, but ever since I saw how JohnTP separates his pingbacks and trackbacks from his regular comments I’ve wanted to take the time to figure out just how to do that myself.

From the user’s perspective, separating pingbacks and trackbacks provides a nice, clean look that doesn’t break up the flow of reader comments. As such, I hope every blog seriously considers separating pingbacks and trackbacks from regular comments. If you’re still having doubts I’d like to make the choice easier for you: the steps below show you how to separate comments from pingbacks and trackbacks.

First, you will need to modify the comments loop in your template’s comments.php file and add the following code:

<?php $comment_type = get_comment_type(); ?>

This will make the $comment_type variable available so that you can place an if () statement to determine if the comment is a comment, pingback, or trackback.

Next, you’ll need to add an if () statement inside of your comments loop so that only normal comments are shown. To do this you’ll need to wrap all of the code inside of the comments loop between:

<?php if ($comment_type == 'comment') { ?>

and

<?php } ?>

Now that you’re only showing normal comments, you’ll need to make a copy of your comments loop so that you now have two comment loops, one right after the other. The only change you’ll need to make in the second loop is to change:

<?php if ($comment_type == 'comment') { ?>

to

<?php if ($comment_type != 'comment') { ?>

Now all you have to do is style the second loop to your liking. For my template I stripped out the excerpt text and added the following code to print out an appropriate indicator for pingbacks and trackbacks:

<?php
if ($comment_type == 'pingback') {
    echo "Pingback";
} else if ($comment_type == 'trackback') {
    echo "Trackback";
}
?>

Now that you know how to separate your regular comments from pingbacks and trackbacks what are you waiting on? Go separate them already!

Tags: , , , , ,

Did You Remember to Update Your Wordpress Time Zone Offset for DST?

When I published yesterday’s blog post I realized it was posted an hour later than it was supposed to.

I had set the post to publish at a little after 6am Eastern, but instead it was published at a little after 7am Eastern.

This lead me to believe there was some sort of Wordpress DST bug that needed to be patched, but thanks to this post it turns out that Wordpress has never had any code to adjust for DST.

As such, if you’re like me and forgot to update your time zone offset then it’s about time you go ahead and do it, and stop living in the past already!

To update your time zone offset go to your Wordpress administration interface and go to the Options menu. If not there already, ensure you’re at the General tab. At the General tab update your time zone offset to the appropriate number. If you’re on Eastern Time, like me, then update this from -5 to the now correct -4. If you’re in a different time zone then you’ll need to update accordingly.

Someone’s already requested Wordpress add code to handle DST changes, so maybe this won’t be a big issue in the future.

What are you waiting for? Come on ahead into the future with the rest of us already!

Tags: , , , , ,