-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Closed
Labels
[Block] Author NameAffects the Author Name BlockAffects the Author Name Block[Block] Post AuthorAffects the Post Author BlockAffects the Post Author Block[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Description
Description
In #67136, a logic has been added to check if a custom post type supports author
, to prevent author information leakage. However, $block->context
may be an empty array in some scenarios, which causes a PHP undefined array key error. One example is when the author has not published any article yet.
Step-by-step reproduction instructions
- Add a new user with the "Editor" role. This user has no posts.
- Add an Author Archives template:
<main class="wp-block-group">
<!-- wp:query-title {"type":"archive"} /-->
<!-- wp:post-author /-->
<!-- wp:post-author-name /-->
</main>
<!-- /wp:group -->
- Access http://localhost:8888/?author=2 (Change the
author
param value to the actual user id for the newly added user) - Confirm that two PHP warning logs are displayed.
Screenshots, screen recording, code snippet
Author Archives Template
Frontend
Environment info
No response
Please confirm that you have searched existing issues in the repo.
- Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
- Yes
Please confirm which theme type you used for testing.
- Block
- Classic
- Hybrid (e.g. classic with theme.json)
- Not sure
Metadata
Metadata
Assignees
Labels
[Block] Author NameAffects the Author Name BlockAffects the Author Name Block[Block] Post AuthorAffects the Post Author BlockAffects the Post Author Block[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended