Reply To: How to get Custom Field input text value and display on search to match my acf.

Home Forums Product Support Forums Ajax Search Pro for WordPress Support How to get Custom Field input text value and display on search to match my acf. Reply To: How to get Custom Field input text value and display on search to match my acf.

#8732
Ernest Marcinko
Ernest Marcinko
Keymaster

Well, I don’t know if that is possible at all, maybe by sending additional parameters by modifying the results url.

The problem is, that the $_POST variable is only set on the search results page, immediately after the search. So when clicking on a result, there is no information sent. However there are filters available to modify the results link, and maybe it is possible to send additional information.

Try adding this custom filter function to your active theme directory, into the functions.php file:

add_filter( 'asp_results', 'asp_change_url_results', 1, 1 );
 
function asp_change_url_results( $results ) {
  foreach ($results as $k=>$v) {
    if ( isset($_POST['options']['aspf1_11']['postcode']) )
      $results[$k]->link  .= "&postcode=" . $_POST['options']['aspf1_11']['postcode'];
  }
 
  return $results;
}

This will add an additional parameter to the end of each result link, which should be accessible via the $_GET[‘postcode’] variable on the results page. I’m not sure if the $_POST[‘options’][‘aspf1_11’][‘postcode’] is correct, you might have to do a var_dump($_POST) within that function to see how it looks like.

Best,
Ernest Marcinko

If you like my products, don't forget to rate them on codecanyon :)