• Hi,

    I got some error log on the website and the error is:

    [19-Feb-2021 20:58:59 UTC] PHP Warning: Invalid argument supplied for foreach() in /home/mydomain.com/wp-content/themes/generatepress/inc/structure/post-meta.php on line 342

    Can you fix it please?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Theme Author Tom

    (@edge22)

    Hi there,

    Do you have any custom functions added to your site? Specifically, any functions using one of these filters?:

    generate_header_entry_meta_items
    generate_footer_entry_meta_items

    If so, can you share the functions with us?

    Thread Starter biznext

    (@biznext)

    Yes,

    I have these 2:

    add_action( 'after_setup_theme', function() {
    	add_filter( 'generate_footer_entry_meta_items', '__return_false' );
    	add_filter( 'generate_header_entry_meta_items','__return_false' );
    } );

    Hi there,

    Yes that’s the cause of the error.

    Are you trying to completely remove the post meta from HTML or do you want to simply hide it from displaying?

    • This reply was modified 3 years, 2 months ago by Elvin.
    • This reply was modified 3 years, 2 months ago by Elvin.
    Thread Starter biznext

    (@biznext)

    Hi,

    I can hide it via css {display:none;}

    But I want to remove it also from the HTML,

    Hi there,

    use this to unhook them:

    add_action( 'wp', function() {
    	remove_action('generate_after_entry_content', 'generate_footer_meta');
    	remove_action('generate_after_entry_title', 'generate_post_meta');
    });
    Thread Starter biznext

    (@biznext)

    Hi @diggeddy

    Seem it works and no error log.

    Thank you!

    Glad to hear that

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Invalid argument supplied for foreach()’ is closed to new replies.