How to change the results URL to something else?
Replacing with a static URL
add_filter( 'asp_results', function ( $results, $search_id, $is_ajax, $args ) {
// Replaces each result URL with this
$replace_with = 'https://google.com';
// --- DO NOT CHANGE ANYTHING BELOW ---
foreach ($results as $k=>$r) {
// Ajax results link
if ( isset($r->link) ) {
$r->link = $replace_with;
}
}
return $results;
}, 10, 4 );Replacing multiple different URLs within the results
Parsing the url from post meta
Last updated