OpenSearch RSS AutoDiscovery for WordPress Searches

I started to compile a “wish list” of WordPress plugins. Turns out, many of my wishes have already come true – it just took a little digging on Google. Too bad there’s not an amazingly comprehensive WordPress plugin directory / wiki (and if there is, nobody really knows about it yet). One of my wishes was for an OpenSearch feed. Turns out Williamsburger already created a plugin, with a WP 2.0 compatible version linked from his comments thread. This got me up and running with my own OpenSearch feed easily enough, but I wanted to have it actually be autodiscoverable within a search query. Without bothering anybody in my personal circle, I found the variables I needed to insert between at the top of my header.php template:

[php]< ?php if (is_search()) { ?>
< link rel="alternate" type="application/rss+xml" title=": < ?=wp_specialchars($s); ?>” href=”< ?=wp_specialchars($s); ?>” />
< ?php } ?>[/php]There you go. An autodiscoverable feed for your WordPress searches! Try a search on my blog for a living example. Couldn’t have gotten it done unless Shayne figured out what I was doing wrong within the .htaccess file. Ugh. I’ve gotta start learning more about Regular Expressions. FUN!

5 thoughts on “OpenSearch RSS AutoDiscovery for WordPress Searches”

  1. I don’t understand that this does. Is this for the browsers to allow for the RSS discovery? I thought that WP already did that?

  2. “Too bad there’s not an amazingly comprehensive WordPress plugin directory …”

    There’s one at that has a lot of stuff, but many of the plugins need updating for WP2.0+. It’s still a great little resource though. You’ll find some gems there.

  3. I think this is the more correct version for autodiscovery
    <link type=”application/opensearchdescription+xml” rel=”search” href=”” title=”: “>

  4. I get an error about firefox not being able to download the search plugin os-description.php from your site. I’m also trying to get this to work on wp 2.1.3 and not having any luck. Do you have to enable it in the plugins? I don’t see it in my plugins area.

Comments are closed.