OK, I just got an ACF text field to display in the search results, but not an image custom field.
Some additional info: I can get my custom field titled wh1 to display in the search results, but not the image custom field named add_image_search_results.
The wh1 field is a standard wordpress custom field, not an ACF field.
Hi John – Perhaps this will help us. I really appreciate anything you can do to help.
I’m using relavennsi and found this discussion where ACF support assisted people in getting something very similar to work. Does this info help at all?
https://www.relevanssi.com/knowledge-base/add-custom-fields-search-excerpts/
Using the filter supplied by Relavenssi, I entered my custom field names, but the images don’t display:
add_filter(‘relevanssi_excerpt_content’, ‘custom_fields_to_excerpts’, 10, 3);
function custom_fields_to_excerpts($content, $post, $query) {
$custom_field = get_post_meta($post->ID, ‘add_image_search_results‘, true);
$content .= ” ” . $custom_field;
$custom_field = get_post_meta($post->ID, ‘wh1‘, true);
$content .= ” ” . $custom_field;
return $content;
}
Hi John – Thanks for the response. I’d love to add a filter that alters what’s being output.
Right now I am using these filters on the search.php page of my child theme.