Just another contact form plugin. Simple but flexible.
About Disable Search
This plugin disables the search functionality on the front-end of your WordPress site. It prevents the search form from appearing, disables the search widget and search block, and returns a 404 error for any search requests. It does not affect searching in the admin section of your site.Frequently asked questions
What does this plugin do?
This plugin prevents WordPress from allowing and handling any search requests from the front-end of the site.
What does the plugin do to the search form?
The plugin prevents the search form from appearing if the theme uses the standard get_search_form() function to display the search form, or if the theme uses a searchform.php template.
What does the plugin do to the search widget?
The plugin disables the search widget by removing it from the list of available widgets and deactivating any search widgets currently in use in any sidebars.
What does the plugin do to the search block?
The plugin disables the search block by removing it from the list of available blocks and deactivating any search blocks currently in use, such as in posts or as a widget.
What response does the plugin give for search attempts?
The plugin gives a 404 File Not Found response, rendered by your site's 404.php template, if present.
Changelog
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
.gitignorefile - Unit tests:
- Fix: Allow tests to run against current versions of WordPress
- New: Add
composer.jsonfor PHPUnit Polyfill dependency - Change: Prevent PHP warnings due to missing core-related generated files
2.0 (2021-09-13)
Highlights:
- 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/binintotests/
- 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
Full changelog is available in CHANGELOG.md.