Retain co-author data when setting archive author #279
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before: when we were setting the post author of a post who's post author ID (according to the
author
value in thewp_posts
table) no longer existed, we also removed any co-authors attributed to that postNow: we set the author ID in the
wp_posts
table to the archive author ID, but the co-author attribution is retained. This ensures that e.g. attribution for posts where the original user's WordPress user record has been removed, but they still have a co-author profile, is maintainedHow to test
archive_author
option set in yourwp_sitemeta
table:wp network meta get 1 archive_author
in WP CLI. If you do, delete it:wp network meta delete 1 archive_author
wp_posts
table so that itspost_author
points to a non-existent user ID, e.g.UPDATE wp_posts SET post_author=999 WHERE ID=[the ID of the post you just published]
. You may need to change the table name depending on whether you published the post on a subsiteSELECT post_author FROM wp_posts WHERE ID=[the ID of the post]
. It should still be the non-existent author ID you changed it towp network meta add 1 archive_author [the ID]
archive_author
value you set