Mostly the default search option in WordPress will display results as per the date but not by the post relevance. The WordPress inbuilt search will give high priority to the posts that are uploaded recently even if the old posts exactly match with the keywords or search terms entered.
In spite of its huge popularity among the website users, WordPress still has several issues to be fixed when it comes to the search department.
Though there are several plugins that can come to your rescue to improve the search results and if you don’t want to install any external plugin, there is one best option for you that can add the functionality of an advanced search engine for your website. One such great available option is replacing the WordPress search with ‘Google custom search’.
Creating a Google Custom Search Engine:
To create a custom search engine, you must first reach the Google Custom Search Engine option and then login into it through your Google account. On logging in perfectly, you need to tap on the option New Search Engine and then furnish your site’s URL.
By default, the URL will be used as the name for your Google Custom Search Engine and then tap on the Create button to move further in the procedure.
Immediately a notification gets displayed on the next page which shows that you have crafted your own custom search engine. You are even provided with an option to get a public URL for the custom search engine that you have created.
You have to tap on the Get Code button to add the custom search engine to your WordPress website and instantly a code gets generated for your search engine.
Inserting the Google Custom Search into WordPress:
Reach the Appearance option present within in the WordPress admin area and then click on the editor option to open the searchfrom.php file in any text editor. Then you need to paste the code in file that is generated from the above step.
In case, if your WordPress theme doesn’t include any searchform.php file, you have to create one file on your own by using any text editor and uploading it to any FTP client. On pasting the code into file, you can reach the Widgets field and just drag–drop the widget onto sidebar.
Configuring the Look of Google Custom Search Engine:
To edit the appearance of your Google Custom Search Engine, you need to reach the Custom search website and start editing the search engine. The complete settings relevant to your Google Custom Search Engine get displayed, from where you need to hit the Look and Feel option present on the sidebar.
You can apply any pre-existing themes for your search engine and you can even hit the customize tab to set the border, font and colour of your choice. Once done with the changes, you can simply save them and the changes can be viewed on your website.