PHP Warning: foreach() argument must be of type array|object, null given
-
Hi,
I’ve been seeing the following error in my error log for months now, but it wasn’t a daily occurence. However, it started happening a few times daily in the last 4 days.
PHP Warning: foreach() argument must be of type array|object, null given in …/content/themes/generatepress/inc/structure/post-meta.php on line 338
This line is the first in this code:
foreach ( $items as $item ) { $default_display = true; if ( 'comments-link' === $item && is_singular() ) { $default_display = false; }
Just before it is this code (just part of it):
/** * Remove post meta items from display if their individual filters are set. * * @since 3.0.0 * @param array $items The post meta items. */ function generate_disable_post_meta_items( $items )
I’m also using filters to display the updated date and link author name to a custom page (not author archive).
I see no errors on the frontend.
My question: Is this a theme coding issue or is it happening because of my filters maybe? Is there a way to fix it?
Thank you!
- The topic ‘PHP Warning: foreach() argument must be of type array|object, null given’ is closed to new replies.