X

How to Use Firefox Opensearch on Your WordPress Blog

Snippets by IsItWP

Do you want your users to use Firefox opensearch? It’ll help replace the general search engines like Google and Firefox with your WordPress blog. While there’s probably a plugin for this, we have created a quick code snippet that you can use to allow users to change search option and select your blog.

Instructions:

All you have to do is add this code to a text file and save it as opensearch.xml. You need to upload this file on your WordPress root directory:

<?xml version="1.0" encoding="utf-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"> 
  <ShortName>wpsnipp.com (code search)</ShortName> 
  <Description>Search WordPress code snippets</Description> 
  <InputEncoding>UTF-8</InputEncoding> 
  <LongName>Ny Site Search</LongName> 
  <Image height="16" width="16" type="image/x-icon">http://mysite.com/favicon.ico</Image> 
  <Url type="text/html" method="get" template="http://mysite.com/?s={searchTerms}"/>  
</OpenSearchDescription> 

Add this code snippet in the header.php file of your WordPress theme. Make sure to replace ‘mysite.com’ with your website URL in both the code snippets.

<link title="mysite.com - Search" type="application/opensearchdescription+xml" rel="search" href="http://mysite.com/opensearch.xml">

Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly add code snippets in WordPress, so you don’t accidentally break your site.

If you liked this code snippet, please consider checking out our other articles on the site like: 20 best WordPress church themes for expanding the flock and how to start a blog.

Comments   Leave a Reply

  1. Seems you also need to add the following to your themes header.php, in order to get Firefox to recognise the opensearch.xml file…

    Once added you can then select your site as a search plugin like Google, Bing and Wikipedia etc.

    1. Whoa, good call Dale I completely forgot to add this in the sample, thanks!

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!