Categories

Disable Search

Author: Scott Reilly
Version: 2.1.1
First released: 2009-06-11
Last update: 2025-04-14
Compatibility: WP 4.6 – 6.8.3
Download: [ zip ]
Description:

Disable the built-in front-end search capabilities of WordPress.

Extended Description

This plugin prevents WordPress from allowing and handling any search requests from the front-end of the site. Specifically, this plugin:

  • Prevents the search form from appearing if the theme uses the standard get_search_form() function to display the search form.
  • Prevents the search form from appearing if the theme uses a searchform.php template
  • Prevents the search item from appearing in the admin tool bar when shown on the front-end.
  • Disables the search widget.
    • Removes the Search widget from the list of available widgets
    • Deactivates any search widgets currently in use in any sidebars (they are hidden, not deleted; they’ll reappear in their original locations if this plugin gets deactivated)
  • Disables the search block.
    • Removes the Search block from the list of available blocks
    • Deactivates any search blocks currently in use, such as in posts or as a widget (they are disabled, not deleted; they’ll reappear if this plugin gets deactivated and the associated placeholder block doesn’t get deleted)
  • With or without a search form, the plugin prevents any direct or manual requests by visitors, via either GET or POST requests, from actually returning any search results.
  • Submitted attempts at a search will be given a 404 File Not Found response, rendered by your site’s 404.php template, if present.
  • Disables output of SearchAction in SEO schema by the Yoast SEO plugin.

The plugin only affects search on the front-end of the site. It does not disable searching in the admin section of the site.

Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage

Find out more at the plugin’s WordPress Plugin Repository page.

Installation

  1. Install via the built-in WordPress plugin installer. Or install the plugin code inside the plugins directory for your site (typically /wp-content/plugins/).
  2. Activate the plugin through the ‘Plugins’ admin menu in WordPress

Release Log

2.1.1 (2025-04-14)

  • Change: Discontinue unnecessary explicit loading of textdomain
  • Hardening: Ensure translated error message doesn’t contain markup
  • Change: Note compatibility through WP 6.8+
  • Change: Note compatibility through PHP 8.3+
  • Change: Update copyright date (2025)
  • Unit tests:
    • Change: Use expectException() instead of @expectedException comment (for PHPUnit 9 support)

2.1 (2024-08-08)

  • Change: Remove the admin bar search field with a higher priority than what it was changed to in WP 6.6.
  • Change: Check if core/search block is registered before attempting to unregister. Props toru.
  • Change: Note compatibility through WP 6.6+
  • Change: Update copyright date (2024)
  • Change: Remove development and testing-related files from release packaging
  • Unit tests:
    • Hardening: Prevent direct web access to bootstrap.php
    • Fix: Define functions now expected by the bundled theme being used
  • New: Add some potential TODO items

2.0.1 (2023-09-02)

  • Change: Safeguard JS from throwing error if WP JS isn’t loaded (should be rare to never)
  • Change: Note compatibility through WP 6.3+
  • Change: Update copyright date (2023)
  • Change: Tweak code alignment
  • New: Add .gitignore file
  • Unit tests:
    • Fix: Allow tests to run against current versions of WordPress
    • New: Add composer.json for PHPUnit Polyfill dependency
    • Change: Prevent PHP warnings due to missing core-related generated files

Copyright & Disclaimer

Copyright © 2009-2026 by Scott Reilly (aka coffee2code)

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Discussion / Support

Have any questions, comments, or suggestions? Please provide them via the plugin’s WordPress.org support forum. I’ll do my best to reply in a timely fashion and help as best I can.

Unfortunately, I cannot provide guaranteed support, nor do I provide support via any other means.

Was this plugin useful useful to you? Consider giving it a rating. If you’re inclined to give it a poor rating, please first post to the support forum to give me a chance to address or explain the situation.

3 replies on “Disable Search”