Google Search for WordPress

Replaces WordPress Search with Google Search. You must abide by Google’s terms of use, the
most important of which is that you must include “powered b

Author:Weston Ruter (profile at wordpress.org)
WordPress version required:2.7
WordPress version tested:2.8
Plugin version:0.2
Added to WordPress repository:15-09-2009
Last updated:15-09-2009
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
Rating, %:0
Rated by:0
Plugin URI:http://wordpress.org/extend/plugins/google-se...
Total downloads:11 399
Active installs:400+
plugin download
Click to start download

Note: This documentation is a first-stab and hasn't been thoroughly edited.

This plugin is developed at Shepherd Interactive for the benefit of the community. No support is available. Please post any questions to the support forum.

Replaces WordPress Search results with results from Google Search Ajax API for Flash and other Non-Javascript Environments. You must abide by Google's terms of use, the most important of which is that you must include "powered by Google" with the search form (searchform.php) and search results (search.php). Furthermore, as is advised by the API documentation that you supply an API key in the 'google_ajaxsearch_api_key' option which can be done on the options page. Sign-up for an AJAX Search API Key.

Requires at least PHP 5 and that json_decode() be defined.

Note that Google must have indexed your blog's content in order for it to appear in the Google-powered WordPress search (hence you must have your blog visibility set to public). Newly-published content won't appear immediately in the search results. Furthermore, the Google Search API only returns results either 4 (small) or 8 (large) results at a time, thus the posts_per_page setting is ignored, and at most 8 results are always displayed on each search result page.

The post objects returned do not have their corresponding WordPress IDs associated with them or other WordPress post metadata. You will only have access to:

  • post_title (invoked by the_title())
  • post_excerpt (invoked by the_excerpt())
  • post_content (invoked by the_content(), same as post_excerpt)

However, there is an addition property "google_search_result" that has all of the information that the Google Search API provided for the result. Do not invoke the following template tags since the data won't be available (not exhaustive):

  • the_ID()
  • the_category()
  • the_author()
  • the_date()
  • the_time()
  • edit_post_link()
  • comments_popup_link()

The default WordPress search in the admin backend is not replaced with Google Search.

More information about how the plugin works can be found in the source code of the plugin itself. See also the "Google Search" options page that is added to the Settings admin menu.

Plugin Hooks

  • Filter: google_search_highlight_start_tag, default: '<b>' -- this is the start tag for the highlighted search term in the search results (for HTML5, this should be filtered to return <mark>)
  • Filter: google_search_highlight_end_tag, default: '</b>' -- this is the start tag for the highlighted search term in the search results (for HTML5, this should be filtered to return </mark>)
  • Filter: google_search_site, default: parse_url(get_option('siteurl'), PHP_URL_HOST)) -- this is the site domain that will be provided to the site: operator when querying the Google API. Useful if you have a staging environment.