I fixed two issues that have been problems on this site since I launched the new site back in November:

  1. Receiving pingbacks didn’t work.
  2. Per post comment feeds were broken.

The first issue was a little tricky. I had a pretty good guess what the problem was, but didn’t know where to look to fix it. I mentioned this while chatting with Matt on Monday night and he knew right away what needed to be done.

Basically, I use the hooks in the permalinks to create custom URLs on this site to simulate having 2 separate blogs (the main blog and the golf blog). I then use the hooks in the query parsing to route the custom URLs to the proper places. The piece I was missing was also accounting for my custom URLs in the url_to_postid function. There wasn’t a hook in there, so I’ve submitted a patch to add one. I believe this will be accepted for 2.2.

Once I was receiving pingbacks properly again, I hacked up a little script to re-send pingbacks to my own site from posts that I’d added since the re-design. Basically, I just did a query in the database for posts with links to my site, put the pingback function in a loop for those posts and re-sent the pings to my site (just the pings to my site).

If you use custom URLs, you need to account for them in 3 places:

  1. The permalinks that get output on your site.
  2. The query parsing that decides what to show.
  3. The url_to_postid code.

I’ve now got all ~200 or so internal pingbacks added in to my site. The dates aren’t right, but you can’t have everything. 🙂

The second issue is somewhat moot as it doesn’t exist in the upcoming WP 2.2 codeline, however a small hack around the if have_posts() call in the wp-commentsrss2.php file seems to have fixed it up until I upgrade to 2.2.

These things have bugged me for months but I was busy with other things, I’m very glad to finally have them fixed.