Previously, we’ve discussed about some WordPress plugins to improve and replace default search engine. The default search does not returns relevant results because the results are based on date rather than relevancy. A solution to this problem would be to use some other alternative such as DuckDuckGo (also known as DDG). In this post, you will learn how to add DuckDuckGo search engine to your WordPress site.
For those who don’t know about DuckDuckGo, then it is a search engine that’s focused on privacy. It does not tracks your search queries and does not collect or share any personal information. This means that you search anonymously, no more search history or tracking.
So if you’re thinking to add/integrate DuckDuckGo to your WordPress based site, then all you need to do is to add the below code to a text widget. You can place that text widget anywhere but placing it in the sidebar is a good idea. Don’t forget to replace yoursiteurl.com in the below code with your actual URL.
<form method="get" id="search" action="http://duckduckgo.com/"> <input type="hidden" name="sites" value="yoursiteurl.com"> <input type="hidden" name="kj" value="b2"> <input type="hidden" name="k7" value="ow"> <input type="hidden" name="k9" value="#606060"> <input type="hidden" name="kaa" value="#2b2b2b"> <input type="hidden" name="kt" value="a"> <input type="text" name="q" maxlength="300" placeholder="Type here to search"> <input type="submit" value="DuckDuckGo Search" style="visibility: hidden;"> </form>
The above code will add a search box to your site, and upon searching, the visitor will be taken to DuckDuckGo with the search results.
This is by far the most easiest method to implement DuckDuckGo. You can also use many additional URL parameters to control various elements like fonts, region settings, color settings, look and feel and more.
Also read: How to Add Google Custom Search to WordPress