This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Settings

#22056
kondorkondor
Participant

hi ernest,

thanks, it works great.

i found out that some other fields are being searched (such as “thumbnail_id”) and if i type a phrase that is included in the id of the thumbnail, it is returned too… which is not ok.

i tried your code by changing it to: …….tm.meta_key NOT LIKE (‘cat_seo_text’,’thumbnail_id’) AND ” . $pre_fiel……… – but after that i get 0 results…

is my query modification wrong?

i also have the following code in functions (so it will return the correct image for result:
add_filter( “asp_results”, “asp_acf_cf_image”, 1, 1 );

function asp_acf_cf_image( $results ) {
// Change this to the ACF custom field name
$image_field = ‘thumbnail_id’;

foreach ( $results as $k => &$r ) {
if ( empty($r->image) && $r->content_type == ‘term’ ) {
$imgID = get_field($image_field, $r->taxonomy . ‘_’.$r->id);
$img = wp_get_attachment_url( $imgID );
// $img = $imgArray[‘url’];
if ( !empty($img) )
$r->image = str_replace(“‘”, “%27”, $img);
}
}
return $results;
}

but even after removing it from functions, still 0 results…

any idea what is wrong here / or maybe how can i safely exclude other terms meta fields that might return wrong results (same as ‘cat_seo_text’ you excluded)?

thanks!