Skip to content

Instantly share code, notes, and snippets.

@hostz-frank
Last active May 22, 2018 21:02
Show Gist options
  • Save hostz-frank/9909e2b773167865a12b4df3f410bd37 to your computer and use it in GitHub Desktop.
Save hostz-frank/9909e2b773167865a12b4df3f410bd37 to your computer and use it in GitHub Desktop.
Remove search field for Theme "Divi" (too close to other links: Pagespeed Insights).
<?php
/**
* Remove search field for Theme "Divi" (to close to other links: Pagespeed Insights).
* Requires the Autoptimze option "Minimize HTML" to be activated.
*/
add_filter( 'autoptimize_html_after_minify', 'divi_remove_search' );
function divi_remove_search( $content ) {
$content = preg_replace(
'/\<div class="et_search.*close_search_field"\>\<\/span\>\<\/div\>\<\/div\>/',
'',
$content
);
return $content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment