FacetWP – support WPJM Field Editor fields

<?php

function fwp_index_wpjmfe( $params, $class ) {

    // An array of facet names
    $keys = array( 'my_resume', 'my_profile' );

    // Is current field a WPJMFE field?
    if ( in_array( $params['facet_name'], $keys ) ) {

        $cf_name = str_replace( 'cf/', '', $params['facet_source'] );
        $values = (array) get_post_meta( $params['post_id'], $cf_name, true );

        // Add values to FWP's index table
        foreach ( $values as $val ) {
            $params['facet_value'] = $val;
            $params['facet_display_value'] = $val;
            $class->insert( $params );
        }
        return false;
    }
    return $params;
}
add_filter( 'facetwp_index_row', 'fwp_index_wpjmfe', 10, 2 );