Improve your WordPress search

WordPress’ standard search isn’t all that good. One could say it sucks.
It sucks for several reasons; results come back in reverse date order, which makes sense for a blog but doesn’t exactly use any relevance. There’s no indication in the search results which words matched. The search just takes all the terms and does a basic sql query for any of them, so if you search for ‘i like cheese’ you get posts with the word like and then posts with the word cheese. You have no idea how many results you got.

Enter Relevanssi, a WordPress plugin which I just added and now;
Search results are ranked based on relevance.
Instead of an excerpt showing the first x characters of the post your get a relevant excerpt showing the part of the text that contains the search terms you used, and they’re highlighted in the text.
You see the search score which tells you which words were found in the text and how many time they were found.

A list of Relevanssi features:

  • Search results sorted in the order of relevance, not by date.
  • Fuzzy matching: match partial words, if complete words don’t match.
  • Find documents matching either just one search term (OR query) or require all words to appear (AND query).
  • Search for phrases with quotes, for example “search phrase”.
  • Create custom excerpts that show where the hit was made, with the search terms highlighted.
  • Highlight search terms in the documents when user clicks through search results.
  • Search comments, tags, categories and custom fields.
  • Adjust the weighting for titles, tags and comments.
  • Log queries, show most popular queries and recent queries with no hits.
  • Restrict searches to categories and tags using a hidden variable or plugin settings.
  • Index custom post types and custom taxonomies.
  • Index the contents of shortcodes.
  • Google-style “Did you mean?” suggestions based on successful user searches.
  • Advanced filtering to help hacking the search results the way you want.

The plugin comes in 2 flavors, free and premium. I’m half tempted to buy the premium just to support the free one as it is already quite feature complete. It’s also rather flexible and offers a lot of tweaking if that’s your cup of tea.

bbPress 2.0.1 released

bbPress 2.0.1 has been released. Tempting.

WordPress plugins used, 2011

Here’s a list of all the WordPress plugins I’m using at the moment in case anyone is interested.
Read more…

Smart 404

Now here’s a great plugin I wish I’d discovered several years ago.
Smart 404 intercepts standard 404 messages and looks through your posts, tags and categories to see if it can come up with a match of what the visitor to your site was looking for. If it finds it, it will display it as a standard archive view displaying the posts.
Example: doesn’t exist, Smart 404 however finds a tag for Azumanga Daioh and thus displays which is a HELL of a lot better than giving your visitor a blank ‘oops, it’s gone’ page.
If Smart 404 doesn’t find anything, at all, it goes to your standard 404 WordPress page, in which you can add some code to have Smart 404 generate a list of posts with the keyword a visitor was looking for (example). Again a big improvement.
I’m very impressed with this plugin, I only wish I’d have come across this years ago when I was moving all the old reviews into WP, that would have saved me from the big nosedive in daily traffic.

(download from the WordPress directory)

Website screenshots for lazy people

If you use a lot of screenshots of websites for your blog you can easily make them through the wonders of
Here is the URL:
All you have to do is insert your required URL in the place of the ‘’ part of the link and resize (‘w=300′) to your required width.

Disable automatic WordPress paragraphs

WordPress automatically wraps content in html paragraphs. Sometimes this can be undesired, for example when you’re making one-liner posts using the new post formats for links or status updates. The easiest way around this is by setting the filter in your template.
It looks like this, snippet taken from my format-status.php:

the_content('Read more...');

First we use remove_filter to tell WordPress not to use automatic < p> tags for the_content, then we output the content, and immediately afterwards we use add_filter to restore the filter or it’ll also be off for all the subsequent posts on the page.

I like draft posts

I like draft posts so much I’m using my own plugin to give me an overview of all of them on the WordPress dashboard seeing as the default view only shows the 5 most recent ones.
My pile of draft posts seems to be getting bigger. It’s just nice to be able to draft an idea, do a little searching, add some links, sit on it for a while, formulate a paragraph here and there, and take your sweet time before getting it to the state where you like to hit publish. For some posts anyway, others (like this one) are obviously just fire and forget.

WordPress 3.0

My my, how does time fly.
WordPress 3.0 has been released and brings us;

  • bulk updates,
  • a new default theme,
  • merge between WordPress and MU<,/li>
  • new theme apis,
  • post types (I like, a lot),
  • taxonomies and lots and lots more.

The only thing now is to find time to actually upgrade.
I wonder what the impact on MU is going to be. And if my theme is compatible.

SQL to change your WordPress links

A simple quickie in case I ever forget, and you might like it too.
Say you have static content, like a folder of pictures, you want to move or rename. But all your posts link to the old folder.
Here’s a quick way to update all your posts in sql, for example using phpMyAdmin:
update wp_posts set post_content = replace(post_content, '\/anime\/pics', '\/anime2\/pics');
In my case this replaces all the links containing ‘/anime/pics’ with ‘/anime2/pics’ as that’s what I renamed the anime folder to.
Note the \/ in the sql statement, you need to escape all your / slashes in the statement by putting a \ before it, or your get errors.

Work in progress... not home!
Trying to get all/most of the new code working before I start on the eyecandy.