Just before the snippet i posted i was doing something like $posts = array();
, it seems that wordpress keeps the collection of the posts to be used on the loop in a variable of the same name, so i was meesing with the data, just changed $posts
for $items
and now works fine.