[Support request] Bug: Header element shows error on author archive page, if author has zero posts

Home Forums Support [Support request] Bug: Header element shows error on author archive page, if author has zero posts

Home Forums Support Bug: Header element shows error on author archive page, if author has zero posts

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2335684
    Michael

    Hi support,

    I’m pretty sure I have the same problem like those 2 threads:
    https://generatepress.com/forums/topic/notice-undefined-offset-0-in-wp-includes-class-wp-query-php-on-line-3275/
    https://generatepress.com/forums/topic/php-error-with-gp-pro-plugin-on-custom-author-php-page/

    But I think I found the exact cause of this: As soon as you enter anything in the “Content” area (template tags like {{post_title}} or even just simple text) in the Header element for the author archive and the author has zero published posts, then this error/warning is shown:
    Warning: Undefined array key 0 in /wp-includes/class-wp-query.php on line 3377

    It’s not a critical problem, as except for this warning message everything works fine. Tip for anybody with the same problem: This means, simply disabling error_reporting “fixes” this problem (which makes sense for live websites anyway) –> in wp-config.php add:

    ini_set( 'display_errors', 'Off' );
    ini_set( 'error_reporting', E_ALL );
    define( 'WP_DEBUG', false );
    define( 'WP_DEBUG_DISPLAY', false );

    But yeah, maybe this helps finding the cause of this bug 🙂

    Thanks and best regards,
    Michael

    #2335915
    David
    Staff
    Customer Support

    Hi Michael,

    thank you for your investigations and reporting this, i can confirm that The Header Element on an empty Author archives throws that error

    We’ll see if we can add some conditional checks to stop that.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.