• Resolved webmasterfreya

    (@webmasterfreya)


    WP 6.0
    Yoast 19.2

    Since the update to 19.2 I see these warnings appear in the error log:

    Got error ‘PHP message: PHP Warning: Attempt to read property “display_name” on bool in
    [..]/wp-content/plugins/wordpress-seo/src/presenters/meta-author-presenter.php on line 40
    , referer: https://www.google.be/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Hey @webmasterfreya,

    Thank you for reaching out!

    I notified our development team, and they investigated it right away. It seems that there is no failsafe on the presenter when there is no author present on the post or page. However, it’s safe to ignore the warning. The development team will make sure to create a fix in a future version to fix this.

    Thread Starter webmasterfreya

    (@webmasterfreya)

    Thanks!

    for now I wrapped it in an if statement and the error went away, until the patch fixes it:

    if ($user_data) {
    
        return \trim( $this->helpers->schema->html->smart_strip_tags( $user_data->display_name ) );
    
    }

    I have this warning as well, it is appearing on my home page, really need a fix for this.

    Hey @shev72,

    If you have the same issue visually on your site, then I recommend disabling WP_DEBUG in your wp-config.php file. It’s not recommended to have it enabled on a live site.

    Hey @mcqtia,

    Yes, it looks like an oversight, our development team will make sure to fix it in a newer version. Thanks.

    Hi @jeroenrotty

    Same here, I have line 40 and also the same message for line 38.

    My WP_DEBUG is already disabled, but these two error messages are still showing.

    Thanks

    The PHP Warning’s root cause is that a page or post’s original author no longer exists in the database. This is based on the wp_user table’s user ID which is attached to a post and can be seen in the database. After digging through WordPress source code I came up with this solution which should be removed once Yoast patches it. This code can be dropped in anywhere in a theme or plugin but must be hooked before the Yoast plugin.

    $original_user = new stdClass();
    $original_user->ID = 1;
    $original_user->display_name = '';
    wp_cache_set(1, $original_user, 'users');

    Hi @zachwtx

    Is this something that is occurring through an error in Yoast not recognising the original author? Because for myself there’s only be one author, and it’s not been removed.

    Hi @jeroenrotty

    I wondered if there is any update on this fix?

    Hey @oriver,

    Yes and no, as in, the fix is created and is going through QA – it should be included in our next release – we release every other week in our normal schedule, so that means most likely next Tuesday.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Attempt to read property “display_name” on bool’ is closed to new replies.