Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Problems with search links › Reply To: Problems with search links
July 9, 2020 at 9:53 am
#28333
Keymaster
Hi,
Thanks for the details, it helps a lot! You have the following custom code in your theme functions.php:
add_filter( 'asp_results', 'asp_custom_link_meta_results', 10, 1 );
function asp_custom_link_meta_results( $results ) {
// Change this variable to whatever meta key you are using
$key = 'wprss_item_permalink';
// Parse through each result item
foreach ($results as $k=>$v) {
if ( function_exists('get_field') )
$new_url = get_field( $key, $v->id, true ); // ACF support
else
$new_url = get_post_meta( $v->id, $key, true );
// Change only, if the meta is specified
if ( !empty($new_url) ) {
$results[$k]->link = $new_url;
}
}
return $results;
}
This modifies the search results link to the wprss_item_permalink custom field value. Removing the custom code will resolve the issue.