Upgraded to WP 3.0.1 and something used to work, but doesn't.
-
I recently upgraded a client site from 2.9.2 to 3.0.1 in order to take advantage of the custom post types. It seems as if it broke something that used to work. In the single.php template, I had been retrieving an array of custom fields outside of the loop. I can use single custom fields… those still work. But retrieving and array no longer works. Instead I get this PHP error message:
Warning: Invalid argument supplied for foreach() in /home/.sites/4/site38/web/wp-content/themes/NATOW_theme/single.php on line 54
Here is the questionable code that was working up until I upgraded:
<?php $custom_fields = get_post_custom(); $my_custom_field = $custom_fields['didYouKnow']; foreach ( $my_custom_field as $key => $value ) // this is 'line 54' that breaks the script echo '<li>' . $value . '</li>'; ?>
I’ve tried a few different things and nothing worked.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Upgraded to WP 3.0.1 and something used to work, but doesn't.’ is closed to new replies.