Advanced search Category suggestions - only parents

Limit the category suggestions to parent cat only in advanced search bar.

add_filter( 'geodir_advanced_search_autocomplete_footer_script', 'gdsnippet_advanced_search_autocomplete_nochild_cat', 99, 1 );
functiong dsnippet_advanced_search_autocomplete_nochild_cat( $script ) {
     return str_replace(
          'request_url=geodir_params.api_url+""+post_type_slug+"/categories/?    orderby=count&order=desc&search="+search+"&per_page="+geodir_search_params.autocompleter_max_results;',
          'request_url=geodir_params.api_url+""+post_type_slug+"/categories/?parent=0&orderby=count&order=desc&search="+search+"&per_page="+geodir_search_params.autocompleter_max_results;',
          $script
     );

}

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us