'post', 'posts_per_page' => '-1', //show all => -1 'tax_query' => array( array( 'taxonomy' => 'category', 'field' => 'slug', 'terms' => 'activitats' ) ), 'order_by' => 'meta_value', //order by meta value 'order' => 'ASC', //order ascendent 'meta_query' => array( array( //filter results show only older than today 'key' => 'xxp_agenda_date_end', 'value' => date("Y-m-d"), // consider using date_i18n() https://developer.wordpress.org/reference/functions/date_i18n/ 'compare' => '<', //show events before today 'type' => 'DATE', ) ) ) ); ?> have_posts() ) : ?> have_posts() ) : $the_query_archive_activitats->the_post(); ?>