Fix: Suppress HTML output from async translation updates during core update #298
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.
When updating WordPress core with non-English locales,
Language_Pack_Upgrader::async_upgrade()outputs HTML markup intended for the admin interface, polluting CLI output with<p>,<div>, and<script>tags.Changes
Added early-priority hook to remove the async translation upgrader before it executes:
This matches the existing pattern used in plugin/theme updates per @swissspidy's recommendation.
Testing
Added Behat test scenario "No HTML output from async translation updates during core update" that verifies:
<p>tags in output<div>tags in output<script>tags in output</div>closing tags in outputFixes #191
Original prompt
This section details on the original issue you should resolve
<issue_title>Unexpected HTML output when updating WordPress</issue_title>
<issue_description>If I update WP using
wp core updateI get a lot of unexpected HTML output coming from WordPress itself:This output is coming from the new WP code to automatically update translations when updating core.
It seems that WP_CLI\UpgraderSkin is not being used in this context because the static method Language_Pack_Upgrader::async_upgrade() instantiate Language_Pack_Upgrader class with a hard coded skin. I guess we will have to open a new ticket on core. I decided to open an issue here first in case anyone has another idea on how to fix this.
</issue_description>
Comments on the Issue (you are @copilot in this section)
@danielbachhuber > I guess we will have to open a new ticket on core.Please link the ticket here when you open it.
@danielbachhuber @rodrigoprimo Can you provide a reproducible test case for this? I'm not sure whether it's still a bug, as I can't reproduce locally. @danielbachhuber @rodrigoprimo 👍 thanks @ernilambar I got similar output when I upgraded from 4.5.3 to 4.6. I ignored it thinking some language update issue. Hindi language was activated in my system. May be it appears in update in language other than default English. @ernilambar Steps to reproduce. - Install WP 4.5.3 - Install and activate `hi_IN` language - Update to 4.6. - After update:A workaround could be to disable async translation updates using
add_filter( 'async_update_translation', '__return_false' );and instead encourage users to usewp language core updateand the like for updates.</comment_new><comment_new>@schlessera
Yes, the behavior for core should be updated to match the one we currently have for plugins/themes.</comment_new>
<comment_new><author...
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.