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

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

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #53635
    David CranleyDavid Cranley
    Participant

    Hi,

    We cannot get filters to respond on page load. When using the filters, nothing happens. When you first use the search bar, and then the filters, it works as expected. It’almost like they are disconnected at first. We’re using live filtering. We’re on Kinsta hosting. We have tried the following:

    • Deactivating other plugins
    • Switching to a default theme
    • Downgrading from PHP 8.3 to 8.2
    • Using a post search/filters instead of the original custom post type/custom fields one
    • Using auto-populate instead of archive results

    Link: https://env-fmsbsite-redev.kinsta.cloud/publications/

    Besides this issue, we’re also looking to utilise the PDF search. We have PDFs attached to the Publications. The Publications have custom data attached to them. When the user searches and the term is in the PDF, we want the relevant Publication it is attached to to show in the results, and link directly to the PDF. Is that possible? Or is the plugin limited to just show the PDF itself, and not the post it is attached to (where the PDF would function as an extension of the post content).

    Please reply to: [email protected].

    Thanks in advance for your help.

    #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.

    #53658
    David CranleyDavid Cranley
    Participant

    Hi Ernest,

    Your recommendation to decrease the live search min characters to 0 indeed fixed that issue, that is great. Thank you. We didn’t expect that that setting would affect the filters as well.

    Have not had the chance yet to test the PDF related code, but will revert back when we do.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.