I've made a loop that goes over all the gigs I've attended, some gigs have the same songs.
Here is the result of that array: http://snippi.com/s/k80v7pe
Now I want to have an array of all the distinct song id's. So want to see all the songs that I've ever heard:
//get the songs field get_field('songs')
foreach ($postIds as $postId){
array_push($songIds, get_field('songs', $postId));
}
//Over here I'm trying to print all the ID's of the song
foreach ($songIds as $songId) {
echo $songId->ID;
}
But I'm getting the following error:
Notice: Trying to get property 'ID' of non-object in
Is that because of that the array $songIds
has an array in an array?