Categories

Disable Search

Author: Scott Reilly
Version: 1.8.2
First released: 2009-06-11
Last update: 2021-04-09
Compatibility: WP 4.6 – 5.7.1
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)
  • 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 download and unzip disable-search.zip inside the plugins directory for your site (typically wp-content/plugins/)
  2. Activate the plugin through the ‘Plugins’ admin menu in WordPress

Release Log

1.8.2 (2021-04-08)

  • Change: Note compatibility through WP 5.7+
  • Change: Update copyright date (2021)
  • Change: Tweak wording and formatting of readme.txt
  • New: Add FAQ entry
  • New: Add unit tests to verify search is removed from admin bar

1.8.1 (2020-09-07)

  • Change: Restructure unit test file structure
    • New: Create new subdirectory phpunit/ to house all files related to unit testing
    • Change: Move bin/ to phpunit/bin/
    • Change: Move tests/bootstrap.php to phpunit/
    • Change: Move tests/ to phpunit/tests/
    • Change: Rename phpunit.xml to phpunit.xml.dist per best practices
  • Change: Note compatibility through WP 5.5+

1.8 (2020-06-02)

  • New: Disable output of SearchAction in SEO schema by Yoast SEO. Props @galengidman.
  • New: Add TODO.md and move existing TODO list from top of main plugin file into it (and add to it)
  • Change: Use HTTPS for link to WP SVN repository in bin script for configuring unit tests
  • Change: Note compatibility through WP 5.4+
  • Change: Update links to coffee2code.com to be HTTPS
  • Unit tests:
    • New: Add tests for hooking actions and filters
    • New: Add test for backend searches not being affected
    • Change: Remove unnecessary unregistering of hooks and thusly delete tearDown()

Copyright & Disclaimer

Copyright © 2009-2021 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”