Skip to content

Commit

Permalink
Upgrade/Install: Add port number to target origin when decrementing u…
Browse files Browse the repository at this point in the history
…pdate counts.

This ensures that the update counter bubble in the admin menu is properly decreased after a successful plugin or theme update from within the update iframe when the site uses a non-standard port number.

Follow-up to [27280], [29357].

Props TobiasBg.
Fixes #59987.

git-svn-id: https://develop.svn.wordpress.org/trunk@57148 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Dec 1, 2023
1 parent 4d19f6c commit 0ce733c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/wp-admin/includes/class-wp-upgrader-skin.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,14 @@ protected function decrement_update_count( $type ) {
if ( defined( 'IFRAME_REQUEST' ) ) {
echo '<script type="text/javascript">
if ( window.postMessage && JSON ) {
window.parent.postMessage( JSON.stringify( { action: "decrementUpdateCount", upgradeType: "' . $type . '" } ), window.location.protocol + "//" + window.location.hostname );
window.parent.postMessage(
JSON.stringify( {
action: "decrementUpdateCount",
upgradeType: "' . $type . '"
} ),
window.location.protocol + "//" + window.location.hostname
+ ( "" !== window.location.port ? ":" + window.location.port : "" )
);
}
</script>';
} else {
Expand Down

0 comments on commit 0ce733c

Please sign in to comment.