I fixed two issues that have been problems on this site since I launched the new site back in November:
- Receiving pingbacks didn’t work.
- 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:
- The permalinks that get output on your site.
- The query parsing that decides what to show.
- 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.
could you explain the pingback script you made in more detail? I could use a script like that to update some older posts that got messed up.
The information here should be enough for a developer to know what to do. For a non-developer, I think it’s too difficult to explain in generic terms.
I currently have a website where I use a couple different wordpress installs for different sections and I would much prefer to have a single install. I believe it would be very much like you did for your main and golf sections.
Unfortunately, I’m a little reluctant to hack my WordPress core…first because it is a bit over my head, and second because I would hate to have to re-integrate the changes for every security release. So I’m wondering–is this done in a plugin? Or could it be done as a plugin?
And if it is, could I use it? I wouldn’t care if the sub-blog(s) and URLs are hard coded–I am up to that level of php coding.
All of my customizations in this area are done in plugins, no core hacks.
Dear Alex,
My blog is all of eight or ten weeks old; your site – as all roads once led to rome – I keep coming back, asi start to get the hang of WordPress and its many plug and widget progeny.
I’m confused by one comment by you on April 25th:
” All of my customizations in this area are done in plugins, no core hacks.”
April 25th, 2007 at 6:29 am
Is “this area” WP generally? or were tiy taking about pingbacks – or something more specific?
Thanks
Jon S.
I was replying to Barry (above).