-
Notifications
You must be signed in to change notification settings - Fork 56
Fix: Suppress HTML output from async translation updates during core update #298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add action hook to disable async translation updates that output HTML to the console when updating WordPress core. This prevents unwanted HTML tags and JavaScript from appearing in the command line output. The fix works by adding an early action hook (priority 1) on 'upgrader_process_complete' that removes the Language_Pack_Upgrader::async_upgrade action (priority 20) before it can execute and produce HTML output. Co-authored-by: swissspidy <[email protected]>
Copilot
AI
changed the title
[WIP] Fix unexpected HTML output during WordPress update
Fix: Suppress HTML output from async translation updates during core update
Nov 6, 2025
This comment was marked as resolved.
This comment was marked as resolved.
Add test scenario that verifies async translation updates don't output HTML tags during WordPress core updates. The test checks that the output doesn't contain <p>, <div>, <script>, or closing </div> tags. Co-authored-by: swissspidy <[email protected]>
This comment was marked as resolved.
This comment was marked as resolved.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Member
|
@copilot use |
Change the closure to a static function since it doesn't use $this instance context or any external variables. This follows best practices and improves performance by avoiding unnecessary binding. Co-authored-by: schlessera <[email protected]>
Contributor
Author
schlessera
approved these changes
Dec 12, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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. The closure uses
static functionsince it doesn't require$thisinstance context.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 outputOriginal 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.