Filter Hooks

IMPORTANT NOTE: Search results are cached by Sumo Search for 30 minutes. When using hooks in the plugin, be aware that your changes might not be visible right away because of caching. To clear the cached search results, SAVE any post or page.

Filter: sumo_search_args

Modify the search parameters for WP_Query

You can use any parameters available in WP_Query. Check the WP_Query entry in the codex for more information.

Sample usage: Display only results from the portfolio custom post type.

add_filter( 'sumo_search_args', 'allow_only_portfolio_post_types' );
function allow_only_portfolio_post_types( $args ) {
	$args['post_type'] = 'portfolio'; // Original value is 'any'.
	return $args;

Filter: sumo_perform_search

Modify the output search results.

The parameter is an associative array of post data. Each data is displayed differently by Sumo Search. e.g. the meta key is displayed below the title. Do a var_dump on the $posts variable to learn more on what's available.

Sample usage: Add the post_meta "genre" in the search results.

add_filter( 'sumo_perform_search', 'add_some_meta_in_results' );
function add_some_meta_in_results( $posts ) {
	// Add the 'genre' label.
	foreach ( $posts as $index => $post ) {
		$genre = get_post_meta( $post['id'], 'genre', true );
		$posts[ $index ]['meta'] = $genre;
	return $posts;

Filter: sumo_generate_search_area

Modify the search overlay HTML.

Sample usage: Change the "No results found" label.

add_filter( 'sumo_generate_search_area', 'my_search_area' );
function my_search_area( $html ) {
	// Change the 'no results found' message.
	$html = str_replace( 'No results found', 'No artists found', $html );
	return $html;

Default search area HTML:

<div class="sumo-search-overlay sumo-search-hide" style="display: none">
	<div class="sumo-search-wrapper">
		<div class="sumo-search-close-button top-right">
			<svg xmlns="" xmlns:xlink="" x="0px" y="0px" width="40px" height="40px" viewBox="0 0 100 100" xml:space="preserve">
				<polygon points="99.999,7.014 92.987,0 50,42.987 7.013,0 0.001,7.014 42.987,50 0.001,92.986 7.013,100 50,57.013 92.987,100 99.999,92.986 57.013,50 "/>
		<div class="sumo-search-bar-wrapper">
			<input type="text" class="sumo-search-bar" placeholder="Search..."/>
			<div class="sumo-search-loading-icon">
				<div class="ss-spinner">
				  <div class="double-bounce1"></div>
				  <div class="double-bounce2"></div>
			<div class="sumo-search-no-results">No results found</div>
		<div class="ss-results">

Filter: sumo_generate_search_button

Modify the frontend search button

Sample usage: Change the generated button HTML.

add_filter( 'sumo_generate_search_button', 'my_search_button' );
function my_search_button( $html ) {
	return '<div class="sumo-search-open-button my-custom-search">Search here</div>';

Default search button HTML:

<div class="sumo-search-open-button top-right">
	<svg xmlns="" xmlns:xlink="" x="0px" y="0px" width="40px" height="40px" viewBox="0 0 100 100" xml:space="preserve">
		<path d="M97.397,87.127l-32.868-30.1c10.376-14.001,9.219-33.859-3.473-46.552c-13.967-13.967-36.613-13.967-50.58,0 c-13.967,13.967-13.968,36.613,0,50.58c12.692,12.692,32.55,13.85,46.551,3.475l30.1,32.868c3.36,3.36,5.275,3.482,8.484,0.274 l2.06-2.06C100.88,92.403,100.757,90.487,97.397,87.127z M15.243,56.288c-11.335-11.335-11.334-29.711,0-41.046 s29.712-11.334,41.046,0s11.334,29.711,0,41.046C44.954,67.623,26.577,67.623,15.243,56.288z"/>