- Author: Scott Reilly
- Version: 2.1
- First released: 2009-06-11
- Last update: 2024-08-09
- Compatibility: WP 4.6 – 6.6.2
- 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.
- Prevents the search form from appearing if the theme uses the standard
-
Installation
- Install via the built-in WordPress plugin installer. Or install the plugin code inside the plugins directory for your site (typically
/wp-content/plugins/
). - Activate the plugin through the ‘Plugins’ admin menu in WordPress
- Install via the built-in WordPress plugin installer. Or install the plugin code inside the plugins directory for your site (typically
-
Release Log
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
- Hardening: Prevent direct web access to
- 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
2.0 (2021-09-13)
- This release finally addresses disabling the search block, notes compatibility through WP 5.8+, and restructures unit test directories.
Details:
- New: Disable the search block
- New: Add
disable_core_search_block()
to unregister block via PHP - New: Add
enqueue_block_editor_assets()
to register JS script to unregister search block via JS - New: Add JS script file to unregister search block
- Change: Update documentation to reflect search block being disabled
- New: Add
- Change: Remove
get_search_form()
and simply use__return_empty_string()
as callback to'get_search_form'
filter - Change: Note compatibility through WP 5.8+
- Change: Tweak installation instruction
- Unit tests:
- Change: Restructure unit test directories
- Change: Move
phpunit/
intotests/
- Change: Move
phpunit/bin
intotests/
- Change: Move
- Change: Remove ‘test-‘ prefix from unit test file
- Change: In bootstrap, store path to plugin file constant
- Change: In bootstrap, add backcompat for PHPUnit pre-v6.0
- Change: Restructure unit test directories
-
Copyright & Disclaimer
Copyright © 2009-2024 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.
Categories
3 replies on “Disable Search”
[…] Disable Search […]
[…] 5th, 2009 · No Comments coffee2code.com » Disable Search Disable the search capabilities of WordPress. Prevent WordPress from allowing and servicing any […]
[…] and only on its own page, due to it’s hefty (and blocking!) JavaScript. I’d long since disabled WordPress’s search since my stories aren’t being run in WordPress, and I didn’t feel like trying to chew […]