Automattic / Automattic/co-authors-plus
Trying to get property 'user_nicename' of non-object (with Yoast SEO)
- Dominant language
- PHP
- Stars
- 322
- Forks
- 216
- Avg merge
- 7h 50m
- Merged PRs (30d)
- 65
Description
I get the following notification when I request the author archive of a guest author.
The guest author has a Display Name and is not mapped to a WordPress User.
The error disappears when Yoast is disabled.
Tested with WordPress 5.2.2, Twenty Nineteen 1.4 and Yoast SEO 11.7.
```
NOTIFICATION : wp-content/plugins/co-authors-plus/co-authors-plus.php:1040 - Trying to get property 'user_nicename' of non-object
require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/twentynineteen/archive.php'), get_header, locate_template, load_template, require_once('/themes/twentynineteen/header.php'), wp_head, do_action('wp_head'), WP_Hook->do_action, WP_Hook->apply_filters, WPSEO_Frontend->head, do_action('wpseo_head'), WP_Hook->do_action, WP_Hook->apply_filters, WPSEO_Frontend->robots, count_user_posts, apply_filters('get_usernumposts'), WP_Hook->apply_filters, CoAuthors_Plus->filter_count_user_posts
```
Contributor guide
Research direction
Start at co-authors-plus.php:1040 and follow the filter_count_user_posts entry in the reported WordPress and Yoast SEO call stack. Reproduce an author archive for a guest author with a display name but no mapped WordPress user, with Yoast enabled and disabled. Done means the notification no longer occurs for this guest-author archive.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- content
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100