WP_Upgrader_Skin::decrement_update_count() WordPress Method

The WP_Upgrader_Skin::decrement_update_count() method is used to decrement the update count for a WordPress site. This is used when a WordPress site is updated to a newer version.

WP_Upgrader_Skin::decrement_update_count( string $type ) #

Output JavaScript that calls function to decrement the update counts.


Parameters

$type

(string)(Required)Type of update count to decrement. Likely values include 'plugin', 'theme', 'translation', etc.


Top ↑

Source

File: wp-admin/includes/class-wp-upgrader-skin.php

	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 );
					}
				</script>';
		} else {
			echo '<script type="text/javascript">
					(function( wp ) {
						if ( wp && wp.updates && wp.updates.decrementCount ) {
							wp.updates.decrementCount( "' . $type . '" );
						}
					})( window.wp );
				</script>';
		}
	}


Top ↑

Changelog

Changelog
VersionDescription
3.9.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.