facetwp wpml indexing

<?php

/** fix for second lang being deleted on post index */
add_filter( 'facetwp_indexer_query_args', function( $args ) {
    if ( function_exists( 'is_checkout' ) && is_checkout() ) {
        return $args;
    }
        
    do_action( 'wpml_switch_language', 'all' );

    $args['suppress_filters'] = true; // query posts in all languages
    return $args;
}, 11 );