In block themes an invalid author ID (such as zero) prevents the filter running on the author name due to some code in the post author block.
This modifies the check for an invalid author ID when pulling/pushing posts to ensure that a valid ID is used.
When pulling from an external post, this removes the author ID of the remove user and records the post as authored by the user pulling the post. Author IDs almost certainly do not match across external connections so there is a risk the author is being assigned to a user that ought not be able to edit the post.
Closes #1129
How to test the Change
Install Distributor on a network
Activate the 2023 theme if required
Create a sub-site
Use WPCLI to generate posts on the main site wp post generate --count=10 -- this will generate posts with the author 0
On the sub-site, uncheck "pull as draft" pull one of the generated posts
Once the post has been pulled, click view for the post
The author block should correctly show the source site on the front end.
Changelog Entry
Fixed - Invalid author IDs being set when pushing and pulling posts.
Description of the Change
In block themes an invalid author ID (such as zero) prevents the filter running on the author name due to some code in the post author block.
This modifies the check for an invalid author ID when pulling/pushing posts to ensure that a valid ID is used.
When pulling from an external post, this removes the author ID of the remove user and records the post as authored by the user pulling the post. Author IDs almost certainly do not match across external connections so there is a risk the author is being assigned to a user that ought not be able to edit the post.
Closes #1129
How to test the Change
wp post generate --count=10
-- this will generate posts with the author0
Changelog Entry
Credits
Props @peterwilsoncc
Checklist: