Apparently the problem was in the “AND” relation. Code now seems to work:
<?php
if(isset($_REQUEST['submit']))
{
$prodotto = $_POST["prodotto"];
$livello = $_POST["livello"];
$ruolo = $_POST["ruolo"];
$stato = $_POST["stato"];
$args = array(
'post_type' => 'corsi',
'posts_per_page' => -1,
'orderby' => 'title',
'order' => 'ASC',
'tax_query' => array(
array(
'taxonomy' => 'prodotto',
'field' => 'slug',
'terms' => $prodotto,
),
array(
'taxonomy' => 'livello',
'field' => 'slug',
'terms' => $livello,
),
array(
'taxonomy' => 'ruolo',
'field' => 'slug',
'terms' => $ruolo,
),
array(
'taxonomy' => 'stato',
'field' => 'slug',
'terms' => $stato,
),
)
);
$soluzioni = new WP_Query($args);
if ( $soluzioni->have_posts() ) {
echo '<ul>';
while ( $soluzioni->have_posts() ) {
$soluzioni->the_post();
echo '<li>' . get_the_title() . '</li>';
}
echo '</ul>';
wp_reset_postdata();
} else
{
echo '<br/> OPPALLA no post';
}
}