MediaWiki extensions manual
OOjs UI icon advanced-invert.svg
Release status: stable
Implementation Search
Description Adds to or replaces Special:Search results with Google CSE results
Author(s) Ryan Finnie (Fo0bartalk)
Maintainer(s) Sophivorus
Latest version 3.1 (2022-09-23)
MediaWiki 1.32+
PHP 7.0+
License GNU General Public License 2.0 or later
Example appropedia.org search result
  • $wgGoogleSiteSearchAppend
  • $wgGoogleSiteSearchOnly
  • $wgGoogleSiteSearchCSEID
  • $wgGoogleSiteSearchAttributes
Quarterly downloads 16 (Ranked 152nd)
Translate the GoogleSiteSearch extension if it is available at translatewiki.net

The GoogleSiteSearch extension allows you to add Google Custom Search Engine (CSE) results to "Special:Search" additionally to MediaWiki search results, or optionally, replace them altogether.


  • Go to the Google CSE management page and add a custom search engine. Note down the "Search engine unique ID". It should be in the format numbers:letters.
  • Download and place the file(s) in a directory called GoogleSiteSearch in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php :
    wfLoadExtension( 'GoogleSiteSearch' );
    $wgGoogleSiteSearchCSEID = 'YOUR_CSE_ID';
  • Configure as required.
  •   Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.


The following configuration parameters are available:

The ID of the created Google custom search engine. Required.
Whether to replace the the MediaWiki search results. If true, only the CSE search results are shown. If false, the CSE results are shown above the MediaWiki results. Optional, defaults to false.
Whether to append rather than prepend the Google search results. Defaults to false. Note that under some circumstances, for example when there're too many or no search results, the relevant hook may not fire and Google search results will not be appended.
An array of optional Custom Search element attributes. For example, to make links open in a new window/tab:
$wgGoogleSiteSearchAttributes = [
	'linkTarget' => '_blank'

In addition, the HTML built by the extension is customizable via the "GoogleSiteSearchHTML" hook. For example:

$wgHooks['GoogleSiteSearchHTML'][] = function ( $specialSearch, $term, &$html ) {
	$html .= '<p>Example append</p>';

See alsoEdit