Change the search results to be products only in Astra

Change the search results to be products only in Astra on child sites.

Snippet Type

Execute on Child Sites

Snippet

add_filter( 'get_search_form', 'astra_get_search_form_callback' );
function astra_get_search_form_callback( $search_form ) {
	$search_form = str_replace( '-1">', '-1"/><input type="hidden" name="post_type" value="product"/>', $search_form ); 
	return $search_form;
}

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.