Skip to content

Instantly share code, notes, and snippets.

@pbov
pbov / functions.php
Last active October 6, 2022 23:24
WP Divi: remove query parameters when using search module
// the search module of divi adds some hidden fields into the search form,
// so you get some (maybe) unwanted additional queries in your search result url.
// field names and values may vary depending on module settings
function remove_hidden_fields_from_search_module($output, $tag) {
// only for Divi search module
if ($tag === 'et_pb_search') {
// remove hidden fields
$output = preg_replace('/<input type="hidden" name="et_pb_searchform_submit" value="et_search_proccess" \/>/', '', $output);
$output = preg_replace('/<input type="hidden" name="et_pb_include_posts" value="yes" \/>/', '', $output);