• Resolved Lai Xuancheng

    (@lai32290)


    I’m following this tutorial (https://developers.elementor.com/custom-query-filter/) to create a custom query filter.
    I would like to filter by a metadata created by ACF (Advanced Custom Field), but it seems not working for me.
    My code is like this:

    
    add_action('elementor_pro/posts/query/my_custom_qurery', function($query) {
        $searchStr = get_search_query();
    
        $meta_query = [
            'key' => 'codigo_de_barra',
            'value' => $searchStr,
            'compare' => '=',
        ];
    
        $query->set('meta_query', $meta_query);
        $query->set('post_type', 'produto');
    });
    

    I’m using the widget “Posts” to display the results and I’m sure that I have set the custom query to Custom ID field, because the post_type is affecting results when I change it.

    Why meta_query is not working?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Meta_query is not working on Custom Query Filter’ is closed to new replies.