This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Filters not responding unless search bar is used first

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Filters not responding unless search bar is used first Reply To: Filters not responding unless search bar is used first

#53641
Ernest MarcinkoErnest Marcinko
Keymaster

Hi,

Thank you very much for the details, it helps a lot!

From looking at the front-end, I suspect the minimum character trigger is set to 3 or more characters instead of the default 0, can you please make sure to set it to 0 here: https://i.imgur.com/RT2xrgb.png
That will resolve the issue.

As for the publications, while there is no option for that, it should be still possible with a small custom snippet:

add_filter(
	'asp_results',
	function ( $results ) {
		foreach ( $results as $r ) {
			if ( $r->content_type !== 'attachment' ) {
				continue;
			}
			$parent_id = wp_get_post_parent_id( $r->id );
			if ( !is_wp_error($parent_id) ) {
				$r->title = get_the_title($parent_id);
			}
		}
		return $results;
	},
	10,
	1
);

Try adding this code via the Code Snippets plugin or to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.