-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Author, Author Name block: fix PHP warning error when there is no context #69949
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, the User REST API doesn't allow listing users if they have no posts written yet. As a follow-up, we may also need to add a check for the number of posts a user has written, in accordance with the REST API specification, in both blocks.
That condition has its problems and might change in the future. See: #69921
@Mamaduka Thanks for the review! I'd like to add @justlevine, who first reported this issue on Slack, to the props list: https://wordpress.slack.com/archives/C02QB2JS7/p1744930825415699 |
Of course! This would be their WP contribution email.
|
…text (#69949) Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: justlevine <justlevine@git.wordpress.org>
A backport PR for the |
…text (#69949) Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: justlevine <justlevine@git.wordpress.org>
Removing the |
…text (WordPress#69949) Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: justlevine <justlevine@git.wordpress.org>
What?
Follow-up #67136
Closes #69948
Why?
Fixes PHP warning error when the Author and Author Name block have no context.
See #69948
How?
Checks for the existence of a context. If it doesn't, it continues with further processing. That is, if the block isn't relevant for a particular post type, it will be rendered.
However, the User REST API doesn't allow listing users if they have no posts written yet. As a follow-up, we may also need to add a check for the number of posts a user has written, in accordance with the REST API specification, in both blocks.
Testing Instructions
author
param value to the actual user id for the newly added user)