This plugin hasn’t 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.

Google Search for WordPress


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.

Contributors & Developers

“Google Search for WordPress” is open source software. The following people have contributed to this plugin.



2009-09-15: 0.2

  • Initial release