Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › How to change the results URL to something else based on the different page id › Reply To: How to change the results URL to something else based on the different page id
May 6, 2020 at 3:16 pm
#27144
Keymaster
Hi,
The $_GET[‘page_id’] is not available in that context, because that is an ajax request. However, the search arguments do include this:
add_filter( 'asp_results', 'asp_custom_link_results', 10, 4 );
function asp_custom_link_results( $results, $id, $is_ajax, $args ) {
foreach ($results as $k=>&$r) {
$r->link = 'https://google.com' . $args['_page_id'];
}
return $results;
}