Search Box Filters

The search box in Max Mega Menu Pro will use the standard WordPress search. It is possible to modify the behaviour of the search box using filters built into Max Mega Menu Pro.

Restricting results to WooCommerce Products

Update: Since publishing this article we have introduced a checkbox option to the Search Replacement and Search Toggle block to restrict search results to WooCommerce Products. The code below is no longer required.

If you are using the WooCommerce, the following code will alter the search box so that results are displayed using the WooCommerce search results template. This code should be added to your themes functions.php file:

Restricting results to Heroic Knowledge Base Articles

Requires Max Mega Menu Pro v1.5.2+

If you are using the Heroic Knowledge Base plugin, the following code will alter the search box so that search results are restricted Knowledge Base Articles. This code should be added to your themes functions.php file:

Changing the search variable from “?s=” to “?gsc=”

Requires Max Mega Menu Pro v1.5+

Max Mega Menu uses the default ‘s’ variable to perform the search. If you are using plugin that uses a different parameter you can use the filter below to change it. This code should be added to your themes functions.php file:

Changing the search path from “/?s=” to “/search/?s=”

Requires Max Mega Menu Pro v1.5+

Max Mega Menu uses the default root path to perform searches. If you are using a different page to display results you can use the filter below to change it. This code should be added to your themes functions.php file:

Related Articles