0

I want to call dyanamically categories in the post widget of Elementor. I created a function to call results from a field created with ACF (a dropbox select of posts categories):

add_action( 'elementor/query/acf_filter', function( $query ) {
    $value = the_field( "category_filters" );
}, 10, 1);

That query doesn't work. All the categories are rendered instead of selected ones. Above, there is the field rendered with categories ID, see the photo: the

Can you help me? Thank you

1 Answer 1

0

I found the solution. Here is it:

add_action( 'elementor/query/acf_filter', function( $query ) {
    $filtre = get_field( "category_filters" );
    $query-> set('cat' , $filtre );

} );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.