Automattic / Automattic/co-authors-plus
Filters for the_author() and the_author_posts_link() do not work
- Dominant language
- PHP
- Stars
- 322
- Forks
- 218
- Avg merge
- 7h 50m
- Merged PRs (30d)
- 65
Description
https://github.com/Automattic/Co-Authors-Plus/blob/3.1.1/php/class-coauthors-template-filters.php#L10
The plugin filters `the_author()` to use `coauthors()` instead, and likewise for `the_author_posts_link()` and `coauthors_posts_links()`. Now, when I rely on the filter and just use either of the author functions in a theme, the user who put the post online is being displayed instead of the co-authors. When I put the two coauthor equivalents in the theme directly, however, everything works as intended. Hence I assume that the filters might be broken.
I stumbled across this with one of my own themes and when I tried to make the Jetpack mobile theme compatible to Co-Authors Plus as per https://github.com/Automattic/jetpack/pull/825. I have used the same database for testing both themes, though, so I am not sure others are experiencing the same issue.
I originally assumed the issue was related to both filters turning off `echo` in their equivalent coauthor functions, but changing that bit did not help. There is one instance when the filter _does_ seem to be working: when `get_the_author()` is called from within the loop but outside of specific posts, like in the heading for author pages in the Jetpack mobile theme.
Contributor guide
Research direction
Start with php/class-coauthors-template-filters.php at the referenced lines and trace the filters for the_author(), the_author_posts_link(), and get_the_author(). Reproduce the behavior from a theme using the standard functions and compare it with the coauthors equivalents; done means the filtered functions display the co-authors consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- backend, content
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100