Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › URL’s not working correctly with Divi FAQ › Reply To: URL’s not working correctly with Divi FAQ
September 21, 2025 at 12:37 pm
#55514
Keymaster
Oh I see, so It needs to add the “faq-item-” as prefix. Try this:
add_filter(
'asp_results',
function ( $results, $id, $is_ajax, $args ) {
if ( $id != 6 ) {
return $results;
}
$to_hash = function ( $str ) {
$str = preg_replace('/\s+/', '-', strtolower($str));
return preg_replace('/[^A-Za-z0-9\-]/', '', $str);
};
// -- Do not change anything below --
foreach ( $results as $k => $r ) {
$r->link = 'https://www.nevadainsuranceenrollment.com/questions-faq/health-insurance-faq/#faq-item-' . $to_hash($r->title);
}
return $results;
},
10,
4
);