echo var into wp_query

The “cat” variable need to be an ID of the category. It depends how you configured the ACF field in the backend.

Maybe you should print_r($selected_cat) to see what’s inside the variable. it is probably an array with the full information of the category.

error code: 523