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: 
Can you help me? Thank you
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
I found the solution. Here is it:
add_action( 'elementor/query/acf_filter', function( $query ) {
$filtre = get_field( "category_filters" );
$query-> set('cat' , $filtre );
} );
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0