FIX / Media Credit Plugin Migrator: save by-hand credits into postmeta #498
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.
This PR fixes a previously merged PR ( #462 ) and adds a new supporting general use command.
The fix:
The previous PR had a note about a possible "loss of data" if a dry-run was not performed. This has been fixed so that a dry-run (while still available) is not required, since the data is now stored into post meta instead of being lost.
The new supporting command:
Now that the data (that would have been lost) is instead stored into post meta, there is now a new CLI command to output this data into a log file for human review. A human can review the data and decide if any further action needs to be taken.
The command:
wp newspack-content-migrator review-media-credit-plugin-other-credits
Output log:
MediaCreditPluginMigrator_cmd_review_media_credit_plugin_other_credits.log
The output log will contain SQL commands that can be reviewed and executed to update existing
_media_credit
post metas.Sample log file output:
Each block will contain the attachment id and the current
_media_credit
postmeta. If the current media credit is acceptable, then no action is needed for this attachment. But if the current media credit is not acceptable (misspellings, grammar, etc) or if one of the other found meta values is better, then execute the SQL to update the value. Or just write your own value and run the update sql or go to the attachment edit page in the wordpress admin and edit the_media_credit
input box there.Caution:
When executing the human-reviewed SQL, be sure to run locally first to make sure it's still valid sql and that single quotes are properly escaped
\'
.Future idea: