Skip to content

Commit 50411e0

Browse files
Copilotswissspidy
andcommitted
Fix: Prevent HTML output during WordPress core update
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 <841956+swissspidy@users.noreply.github.com>
1 parent d1e4157 commit 50411e0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Core_Command.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,6 +1213,15 @@ public function update( $args, $assoc_args ) {
12131213

12141214
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
12151215

1216+
// Prevent async translation updates which output HTML.
1217+
add_action(
1218+
'upgrader_process_complete',
1219+
function () {
1220+
remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
1221+
},
1222+
1
1223+
);
1224+
12161225
if ( $update->version ) {
12171226
WP_CLI::log( "Updating to version {$update->version} ({$update->locale})..." );
12181227
} else {

0 commit comments

Comments
 (0)