WP_Upgrader_Skin::decrement_update_count()
Outputs JavaScript that calls function to decrement the update counts.
Method of the class: WP_Upgrader_Skin{}
No Hooks.
Return
null
. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->decrement_update_count( $type );
- $type(string) (required)
- Type of update count to decrement. Likely values include 'plugin', 'theme', 'translation', etc.
Changelog
Since 3.9.0 | Introduced. |
WP_Upgrader_Skin::decrement_update_count() WP Upgrader Skin::decrement update count code WP 6.8
protected function decrement_update_count( $type ) { if ( ! $this->result || is_wp_error( $this->result ) || 'up_to_date' === $this->result ) { return; } 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.location.port ? ":" + window.location.port : "" ) ); } </script>'; } else { echo '<script type="text/javascript"> (function( wp ) { if ( wp && wp.updates && wp.updates.decrementCount ) { wp.updates.decrementCount( "' . $type . '" ); } })( window.wp ); </script>'; } }