Action hook 'upgrader_overwrote_package'

in WP Core File wp-admin/includes/class-theme-upgrader.php at line 274

View Source

upgrader_overwrote_package

Action Hook
Description
Install a theme package. Default true. }

Hook Information

File Location wp-admin/includes/class-theme-upgrader.php View on GitHub
Hook Type Action
Line Number 274

Hook Parameters

Type Name Description
string $package The full local path or URI of the package.
array $args { Optional. Other arguments for installing a theme package. Default empty array.

Usage Examples

Basic Usage
<?php
// Hook into upgrader_overwrote_package
add_action('upgrader_overwrote_package', 'my_custom_function', 10, 2);

function my_custom_function($package, $args) {
    // Your custom code here
}

Source Code Context

wp-admin/includes/class-theme-upgrader.php:274 - How this hook is used in WordPress core
<?php
 269  		// Refresh the Theme Update information.
 270  		wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
 271  
 272  		if ( $parsed_args['overwrite_package'] ) {
 273  			/** This action is documented in wp-admin/includes/class-plugin-upgrader.php */
 274  			do_action( 'upgrader_overwrote_package', $package, $this->new_theme_data, 'theme' );
 275  		}
 276  
 277  		return true;
 278  	}
 279  

PHP Documentation

<?php
/**
	 * Install a theme package.
	 *
	 * @since 2.8.0
	 * @since 3.7.0 The `$args` parameter was added, making clearing the update cache optional.
	 *
	 * @param string $package The full local path or URI of the package.
	 * @param array  $args {
	 *     Optional. Other arguments for installing a theme package. Default empty array.
	 *
	 *     @type bool $clear_update_cache Whether to clear the updates cache if successful.
	 *                                    Default true.
	 * }
	 *
	 * @return bool|WP_Error True if the installation was successful, false or a WP_Error object otherwise.
	 */
Quick Info
  • Hook Type: Action
  • Parameters: 2
  • File: wp-admin/includes/class-theme-upgrader.php
Related Hooks

Related hooks will be displayed here in future updates.