I have this example array/object:
//$monday array values
Array (
[menu_item1] =>
[menu_item2] =>
Array (
[0] =>
WP_Post Object (
[ID] => 530
[post_content] => Food selection 2
[post_title] => Food 2 ) )
I'm beginner in WP_Post Objects
. How can I get the menu_item1
ID
(if it has value) and menu_item2
ID
value (if it has too)?
The documentation isn't helped me.
I'm sure it's something like but it doesn't work:
foreach ($monday as $key => $value) {
if ($value) {
$myid = $value->ID;
}
}