Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Error Searching for Product Categories › Reply To: Error Searching for Product Categories
September 25, 2020 at 1:56 pm
#29547
Keymaster
Hi,
The issue is caused by a custom code. I cannot tell where exactly it is, I could not find it in the child theme directory. It is probably related to something like this:
add_filter( 'asp_results', 'asp_add_custom_shortcode', 10, 1 );
function asp_add_custom_shortcode( $results ) {
foreach ($results as $k=>&$r) {
// Enter the shortcode into the quotes section
$r->content = do_shortcode('[my_shortoce_here]') . $r->content;
}
return $results;
}
I suspect the “do_shortcode” is not working correctly within the terms context. Try modifying the final code to something like:
add_filter( 'asp_results', 'asp_add_custom_shortcode', 10, 1 );
function asp_add_custom_shortcode( $results ) {
foreach ($results as $k=>&$r) {
if ( isset($r->post_type) ) {
// Enter the shortcode into the quotes section
$r->content = do_shortcode('[my_shortoce_here]') . $r->content;
}
}
return $results;
}