Get all the related data from WordPress DB
Your problem is the constants OBJECT_K. In the documentation you can read that this constant ensures that duplicate keys are discarded. From the wordpress codex entry: Any of ARRAY_A | ARRAY_N | OBJECT | OBJECT_K constants. With one of the first three, return an array of rows indexed from 0 by SQL result row number. … Read more