New Caching System for Wordpress: Batcache

By jaymis

Peter isn’t quite in the habit of sharing our internal CDM research and communiques to the rest of the world, so I’ll re-post his words:

Another caching solution for WP. This story also goes through some of the more generalized performance issues with WP and other solutions…
http://andy.wordpress.com/2008/06/22/batcache-for-wordpress/

This is the system they use for Wordpress.com:

Batcache implements a very simplistic caching model that shields your database and web servers from traffic spikes: after a document has been requested X times in Y seconds, the document is cached for Z seconds and all new users are served the cached copy.

New users are defined as anybody who hasn’t interacted with your domain—once they’ve left a comment or logged in, their cookies will ensure they get fresh pages. People arriving from Digg won’t notice that the comments are a minute or two behind but they’ll appreciate your site being up.

You don’t need PHP skills to install Batcache but you do have to get Memcached working first. That can be easy or hard. We use Memcached because it’s awesome. Once you know how to install it you can create the same kind of distributed, persistent cache that underpin web giants like WordPress.com and Facebook.

Interesting. Will probably be giving this a spin soon.

Comments Containing URLs and Over a Certain Length Not Showing Up in Wordpress

By jaymis

Since upgrading to Wordpress 2.5 we’ve had some issues with certain comments not showing up on the site. These comments exist in the database, they can be edited, and their author details appear, but the actual comment text doesn’t appear on the site.

I’ve tried to troubleshoot this a few times - thinking it may be a mod_security problem, or perhaps just a weird 2.5.1 bug.

Another commenter had his comment eaten tonight, so I went through another round of searching, and eventually discovered this thread on the Wordpress forums.

The answer, he is right down the bottom there: “… a plugin designed to remove the rel=”nofollow” attribute”. A.K.A. Dofollow.

So it seems that Dofollow with WP2.5 breaks things, and causes comments to disappear. Very unfortunate.

For the Masses: WYSIWYG Comments for Wordpress

By jaymis

Peter and I have been talking about implementing WYSIWYG editing for Wordpress comments for a while now. WP’s comments system is reasonably robust, but the HTML instructions seem to confuse some people:

XHTML: You can use these tags: <a href=”" title=”"> <abbr title=”"> <acronym title=”"> <b> <blockquote cite=”"> <cite> <code> <del datetime=”"> <em> <i> <q cite=”"> <strike> <strong>

We quite often receive comments to out sites in which people - probably those unfamiliar with HTML - have taken these instructions to heart and created comments which look a little like this:

You can check it out <a href=”http://example.com” title=”here”>, more updates should be coming soon.

This can cause issues for the site as a whole: Wordpress doesn’t detect this error and close that anchor tag, so the rest of the comment becomes a link, which encompasses everything down the page until the next link in the code is closed. The same kind of thing happens when people put unclosed <strong> tags in their comments. We don’t have any closing </strong> tags in the page source after the comments, so when someone does this the rest of the site becomes emboldened until an administrator corrects the comment.

These kind of errors notwithstanding, WYSIWYG is perfect for comments. I don’t like WYSIWYG editors making decisions for me in my day-to-day coding life, as they rarely output exactly what I want them to, but writing comments is such a constrained activity; with a small number of tags available, the editor can’t really stuff things up too badly.

I’ve previously hacked a cut-down version of TinyMCE into our test bbPress installation. This was relatively simple, so I’d expected that it wouldn’t be hard to get it happening on the Wordpress comments form as well. I did a quick search first, though, to make sure I wouldn’t be duplicating someone else’s efforts. It turns out I would be, as there’s a Wordpress plugin called TinyMCEComments.