I upgraded to Wordpress 4.6.1 and a calendar page that displayed data from a number of different post types, starting showing an error:
Warning: Invalid argument supplied for foreach() in /home/centkuti/public_html/wp-content/themes/central-square-theater/page-templates/page-calendar.php on line 117
This wasn't happening before the upgrade and I examined the code and it hasn't changed. Here are lines 115 to 120:
<?php
$prepost = get_post_custom_values('pre_post_related_show', $row->post_id);
foreach($prepost as $v)
{
//echo $v;
}
?>
Your help is appreciated.
$prepost
is an array, and not null or false, before trying to iterate through it. – aynberforeach
with a commented-out body? – zx485