SearchWP

This Documentation is for SearchWP Version 3

Available since: 2.8.5

searchwp_disable_impose_engine_config

View Parameters »

By default SearchWP will do its best to impose the default engine configuration when an empty search is performed. On a lower level when an empty search is performed (e.g. there is a query parameter of s with an empty string: s=) SearchWP will short circuit because there is nothing for SearchWP to do.

That means that instead of intercepting the request and providing search results, it will let WordPress do what it normally does with an empty search string: return everything.

However, because SearchWP’s powerful engine configuration options (i.e. excluding post types or limiting to certain Categories) it will attempt to impose those limits on the subsequent results set.

If you would like to disable this behavior, you can use the searchwp_disable_impose_engine_config by adding this to your theme’s functions.php:

<?php
// Prevent SearchWP from imposing its engine configuration on empty search requests
add_filter( 'searchwp_disable_impose_engine_config', '__return_true' );
view raw functions.php hosted with ❤ by GitHub

Parameters

Parameter Type Description
$enabled Boolean

Whether the engine configuration should be imposed on the search request