Viewing 1 replies (of 1 total)
  • Thread Starter stieranka

    (@stieranka)

    Hi,
    I found it:

    add_filter( 'facetwp_index_row', function( $params, $class ) {
        if ( 'my_facet' == $params['facet_name'] ) { // change my_facet to name of your facet
            $values = maybe_unserialize( $params['facet_value'] );
            if ( is_array( $values ) && ! empty( $values ) ) {
              foreach ( $values as $value ) {
                      $new_params = $params;
                      $new_params['facet_value'] = $value;
                      $new_params['facet_display_value'] = $value;
                      $class->insert( $new_params ); // insert new value to the database
              }
              return false; // don't index original
            }
        }
        return $params;
    }, 10, 2 );
Viewing 1 replies (of 1 total)
  • The topic ‘Get array (cloneable) meta’ is closed to new replies.