Note: This documentation is a first-stab and hasn’t been thoroughly edited.
Replaces WordPress Search results with results from Google Search Ajax API
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
posts_per_page setting is ignored, and at most 8 results are always displayed
on each search result page.
post objects returned do not have their corresponding WordPress
IDs associated with them
or other WordPress post metadata. You will only have access to:
the_content(), same as
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 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.
'<b>'— this is the start tag for the highlighted search term in the search results (for HTML5, this should be filtered to return
'</b>'— this is the start tag for the highlighted search term in the search results (for HTML5, this should be filtered to return
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.Contributors
Interested in development?
- Initial release