Support » Plugin: Relevanssi - A Better Search » Issues with ACF

Viewing 1 replies (of 1 total)
  • That’s not not true at all! Firstly you must set “custom fields to include in the index” to “all” (settings) and secondly you must copy this script to your functions:

    add_filter('relevanssi_excerpt_content', 'excerpt_function', 10, 3);
    function excerpt_function($content, $post, $query) {
    
    global $wpdb;
    $fields = $wpdb->get_col("SELECT DISTINCT(meta_key) FROM $wpdb->postmeta");
    
    foreach($fields as $key => $field){
    $field_value = get_post_meta($post->ID, $field, TRUE);
    $content .= ' ' . ( is_array($field_value) ? implode(' ', $field_value) : $field_value );
    }
    
    return $content;
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Issues with ACF’ is closed to new replies.