Found problem. I replaced:
$posts = $query->get_posts();
with:
$posts = array();
if ($query->have_posts()){
while ($query->have_posts()){
$query->next_post();
array_push($posts, $query->post);
}
}
And everything is working now.
Found problem. I replaced:
$posts = $query->get_posts();
with:
$posts = array();
if ($query->have_posts()){
while ($query->have_posts()){
$query->next_post();
array_push($posts, $query->post);
}
}
And everything is working now.