Saltar navegación

Open

Topic Tags: Compatibility

Overview of the issue

Elementor Pro’s experimental Taxonomy Filter feature, which is currently in Alpha, exhibits issues when used with the Loop Grid on translated pages and it fails to display the expected results.

Workaround

Please, make sure of having a full backup of your site before proceeding.

Part I

  • Open …/wp-content/plugins/elementor-pro/modules/loop-filter/widgets/taxonomy-filter.php file.
  • Look for line 691.
  • Just after:
    1
    $widget_data = Utils::find_element_recursive( $document->get_elements_data(), $this->get_settings_for_display( 'selected_element' ) );
  • Add this code:
    1
    2
    3
    4
    5
    6
    7
    if (isset($widget_data['settings']['post_query_include_term_ids'])) {
        $translated_data = [];
        foreach ($widget_data['settings']['post_query_include_term_ids'] as $term_id) {
            $translated_data[] = get_term($term_id)->term_id;
        }
        $widget_data['settings']['post_query_include_term_ids'] = $translated_data;
    }

Part II

  • Open your theme’s functions.php file.
  • Add the following code:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    /**
     * @link wpmlsupp-11444
     */
    add_filter( 'elementor/query/query_args', function( $query_args ) {
        $translated_query_args = $query_args;
     
        if (isset($query_args['tax_query'])) {
            foreach ($query_args['tax_query'] as $key => $query) {
                if (isset($query['field']) && in_array($query['field'], ['term_id', 'term_taxonomy_id'], true)) {
                    $query['terms'] = array_map(function( $id ) use ($query){
                        return apply_filters( 'wpml_object_id', $id, $query['taxonomy'], TRUE  );
                    }, (array) $query['terms']);
     
                    $translated_query_args['tax_query'][$key] = $query;
                }
            }
        }
     
        return $translated_query_args;
    }, 100 );

9 respuestas para “Elementor Pro - "Taxonomy Filter" Feature Not Working for Secondary Language”

  1. Hello, this solution works for me, but when there are an update of elementor, the «taxonomy-filter.php» file is update too, and the modification disappear… have you a solid and maintenable solution for that ?
    Many thanks !

    • Hi Pierre,
      Thanks for reaching out! Unfortunately, I can’t provide an ETA for this issue, but it has been escalated to our developers. In the meantime, when you update Elementor Pro, you’ll need to follow the steps in Part I again. The code should now be around line 712. Thanks for your understanding!

        • Hi there,
          Unfortunately, you can’t add this code to your child theme, so you’ll need to reapply it after updating Elementor. That said, our compatibility team is aware of this issue and will review whether we can address it on our end to improve compatibility.

Deje una respuesta

Por favor, mantente dentro del tema y sé respetuoso con los demás. Si necesitas ayuda con cuestiones no relacionadas con este post, utiliza nuestro Foro de soporte para iniciar un chat o enviar un ticket.

Puede utilizar estas etiquetas:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>