Reply To: Collect search phrases when 'No results'

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Collect search phrases when 'No results' Reply To: Collect search phrases when 'No results'

#11685

Ernest Marcinko
Keymaster

Hi!

I would recommend using this code skeleton to extend for the functionality:

add_filter( 'asp_after_search', 'guardar_busqueda', 10, 2 );

function guardar_busqueda($s, $results) {

  if ( empty($results) ) {    
    // No results, no keyword suggestions
  } else if ( isset($results['keywords']) ) {
    // No results, but there are keyword suggestions
  } else {
    // There are results
  }
  
  return $results;
}

This way you can do different actions when there are no results, some keyword suggestions or results present 🙂

Best,
Ernest Marcinko

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