Title: PHP warning
Last modified: June 20, 2026

---

# PHP warning

 *  [bhkh](https://wordpress.org/support/users/bhkh/)
 * (@bhkh)
 * [2 days ago](https://wordpress.org/support/topic/php-warning-571/)
 * I’m getting the following in my logs:
 *     ```wp-block-code
       [pid 423613] fcgid_bucket.c(153): mod_fcgid: stderr: PHP Warning: foreach() argument must be of type array|object, string given in .../mysite.org/wp-content/themes/generatepress/inc/structure/post-meta.php on line 338
       ```
   
 * I’m getting a massive amount of these.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [George](https://wordpress.org/support/users/quantum_leap/)
 * (@quantum_leap)
 * [1 day, 23 hours ago](https://wordpress.org/support/topic/php-warning-571/#post-18943938)
 * Hi,
 * That warning is triggered by a snippet returning an empty string to the `generate_header_entry_meta_items`
   filter. That filter expects an **array** of meta items. When it receives `''`,
   GeneratePress loops over it with `foreach()`, which produces the warning on every
   page load.
 * If you have a snippet like this:
 * `add_filter( 'generate_header_entry_meta_items', function() {
   return '';} );
 * change it to return an empty array:
 * `add_filter( 'generate_header_entry_meta_items', function() {
   return array();});
 * That will stop the warnings while still removing the header meta.
 * Do you have any custom PHP targeting the entry meta, in Code Snippets, your child
   theme’s `functions.php`, or a plugin? If you can paste anything hooking `generate_header_entry_meta_items`,
   I’ll confirm the exact fix.
 *  Thread Starter [bhkh](https://wordpress.org/support/users/bhkh/)
 * (@bhkh)
 * [1 day, 23 hours ago](https://wordpress.org/support/topic/php-warning-571/#post-18943942)
 * Oh, yeah. I have
 *     ```wp-block-code
       // removes meta from under the titleadd_filter( 'generate_header_entry_meta_items', function() {    return '';} );
       ```
   
 * So I will replace `''` with `array()` and see if it stops.
 * Thanks!
 *  [George](https://wordpress.org/support/users/quantum_leap/)
 * (@quantum_leap)
 * [1 day, 23 hours ago](https://wordpress.org/support/topic/php-warning-571/#post-18943950)
 * Ok, no problem!

Viewing 3 replies - 1 through 3 (of 3 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fphp-warning-571%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/generatepress/3.6.1/screenshot.
   png)
 * GeneratePress
 * [Support Threads](https://wordpress.org/support/theme/generatepress/)
 * [Active Topics](https://wordpress.org/support/theme/generatepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/generatepress/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/generatepress/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [George](https://wordpress.org/support/users/quantum_leap/)
 * Last activity: [1 day, 23 hours ago](https://wordpress.org/support/topic/php-warning-571/#post-18943950)
 * Status: not resolved